feat(ui): add custom UserProfile pages to the Mosaic UserButton - #9343
Merged
alexcarpenter merged 2 commits intoAug 6, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 1437c76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Ordering keyed on href for links; path is now required on every entry and is the pageOrder key.
alexcarpenter
merged commit Aug 6, 2026
8eb59e5
into
carp/account-button-experimental-export
13 checks passed
alexcarpenter
added a commit
that referenced
this pull request
Aug 6, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 6, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 6, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 6, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
alexcarpenter
added a commit
that referenced
this pull request
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
userProfilePropsto the experimental MosaicUserButton, for putting your own pages and links into the UserProfile it opens, and for ordering that profile's navigation.Plain objects rather than the
<UserButton.UserProfilePage>children the pre-Mosaic button takes. Every entry has apath, which is what identifies it: withcontentit is a page inside the profile, withhrefit is a link out of it.iconis optional on both.pageOrderentries are ids:account,security,billingorapiKeysfor a built-in page, or a custom entry'spath.Objects also drop the
'use client'requirement the children API carries.UserButton.UserProfilePagemeans dotting into a client module, which RSC forbids ("Cannot access UserProfilePage on the server"), so describing config forced the directive onto the consumer's file and pulled the page into the client bundle. A prop has nothing to dot into: this renders from a server component, andcontentcan stay a server component too.The profile still opens in clerk-js's own React root, which cannot render a node from the host app's tree, so
useCustomPagesbridges the two: each entry goes out as themount/unmountpair clerk-js already takes, and the host tree portals the content into the element it hands back. The portals hang off the container rather than the popover, since they have to outlive whatever opened the profile. When a Mosaic UserProfile lands in-tree, the bridge goes and the props stay.Two things worth a look in review:
iconoff would silently cost you the page.pageOrderhas to send the built-ins that were left out too, appended after the ones that were named. That means knowing which built-ins the instance actually shows, which is whatuseUserProfilePagescomputes, behind the same shared guards clerk-js uses. It cannot seeshouldShowBilling(paid plans / past subscriptions, fetched inside the profile), so an instance with billing enabled but no visible plans gets one dev-only log and the page is dropped, which is what should happen to it anyway.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change