<UserButton/> component

<UserButton /> is the compact account trigger for signed-in users. It shows the current account, opens the account menu, and adapts its actions to the current session and deployment settings.

Usage

The following example shows a basic usage of <UserButton />.

import { SignedIn, UserButton } from '@wacht/nextjs';export default function UserButtonUsage() {  return (    <>      <SignedIn>        <UserButton showName={false} />      </SignedIn>    </>  );}

Properties

All properties are optional unless otherwise noted.

showName?: boolean | undefined;
Whether the active user name is shown next to the avatar trigger.

Behavior

Use it when you want a compact signed-in control in the header or account area. The component renders the avatar trigger and, optionally, the account name beside it.
It is the smaller alternative to mounting the full account surface inline.

Account menu

Clicking the trigger opens a floating menu with the current account, the manage-account action, and the sign-out action for the active sign-in.
The menu uses the current session state, so it reflects the active user rather than a static profile snapshot.

Multi-session behavior

When multi-session support is enabled, the menu sorts sign-ins so the active account stays at the top and the other accounts remain available to switch to.
If more than one sign-in exists, the menu also exposes a way to sign out of all accounts instead of only the active one.

Actions

The manage-account action opens the fuller account settings dialog.
The sign-out action respects the current session mode, so one-sign-in sign-out and full-session sign-out are handled separately.

Examples

Compact header control

import { SignedIn, UserButton } from '@wacht/nextjs';export default function UserButtonCompactHeaderControl() {  return (    <>      <SignedIn>        <UserButton showName={false} />      </SignedIn>    </>  );}

Header control with name

import { SignedIn, UserButton } from '@wacht/nextjs';export default function UserButtonHeaderControlWithName() {  return (    <>      <SignedIn>        <UserButton showName />      </SignedIn>    </>  );}

On this page