The <UserButton /> component is used to render the familiar user button UI popularized by Google.
Clerk is the only provider with multi-session support, allowing users to sign into multiple accounts at once and switch between them. For multi-session apps, the <UserButton /> automatically supports instant account switching, without the need of a full page reload. For more information, you can check out the Multi-session applications guide.
Controls if the user name is displayed next to the user image button.
Name
signInUrl
Type
string
Description
The full URL or path to navigate to when the Add another account button is clicked.
Name
userProfileMode
Type
'modal' | 'navigation'
Description
Controls whether clicking the Manage your account button will cause the <UserProfile /> component to open as a modal, or if the browser will navigate to the userProfileUrl where <UserProfile /> is mounted as a page. Defaults to: 'modal'.
Name
userProfileUrl
Type
string
Description
The full URL or path leading to the user management interface.
Name
afterSignOutUrl
Type
string
Description
The full URL or path to navigate to after a signing out from all accounts (applies to both single-session and multi-session apps).
Name
afterMultiSessionSingleSignOutUrl
Type
string
Description
The full URL or path to navigate to after a signing out from currently active account (multi-session apps).
Name
afterSwitchSessionUrl
Type
string
Description
The full URL or path to navigate to after a successful account change (multi-session apps).
Name
defaultOpen
Type
boolean
Description
Controls whether the <UserButton /> should open by default during the first render.
Name
userProfileProps
Type
object
Description
Specify options for the underlying <UserProfile /> component. For example: {additionalOAuthScopes: {google: ['foo', 'bar'], github: ['qux']}}.
In the following example, <UserButton /> is mounted inside a header component, which is a common pattern on many websites and applications. When the user is signed in, they will see their avatar and be able to open the popup menu.