UserButton
Account menu with avatar, profile modal/navigation, and composition API.
The <UserButton> component displays the signed-in user's avatar and a dropdown menu with account actions. It supports modal and navigation modes for opening the user profile, plus a composition API for custom menu items.
Installation
pnpm add @wocha/ui @wocha/reactOr scaffold with the CLI
npx @wocha/cli init --framework nextjsBasic usage
Use variant="compact" for avatar-only display in dense headers.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "compact" | "full" | "full" | Compact shows avatar only; full shows name and email |
profileUrl | string | — | Profile link — navigates on click |
organisationUrl | string | — | Organisation settings link |
userProfileMode | "modal" | "navigation" | "modal" | How the user profile opens when "Manage account" is selected |
userProfileUrl | string | — | Destination when userProfileMode is "navigation" |
userProfileProps | UserProfileProps | — | Props forwarded to embedded UserProfile in modal mode |
appearance | WochaAppearance | — | Visual customisation |
className | string | — | Additional class name |
menuItems | Array<{ label, icon?, onClick }> | [] | Custom menu items appended before sign out |
children | ReactNode | — | Composition children (UserButton.MenuItems, etc.) |
fallback | ReactNode | — | Shown while auth context is loading |
Modal and navigation modes
Open the profile in an overlay (default) or navigate to a dedicated page:
Composition API
Extend or reorder menu items with compound sub-components:
Use default item keys (manageAccount, organisation, signOut) as label values to reorder or replace built-in entries.
Theming
Framework notes
| Framework | Notes |
|---|---|
| React SPA | Place in your app header inside WochaProvider |
| Next.js | Works in client components; use userProfileUrl for App Router pages |