Skip to content

refactor(ui): sign the Mosaic Card with Clerk, not the UserButton - #9416

Merged
alexcarpenter merged 2 commits into
mainfrom
carp/mosaic-card-branding
Aug 12, 2026
Merged

refactor(ui): sign the Mosaic Card with Clerk, not the UserButton#9416
alexcarpenter merged 2 commits into
mainfrom
carp/mosaic-card-branding

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Aug 12, 2026

Copy link
Copy Markdown
Member

Description

The "Secured by Clerk" mark belonged to the UserButton's popup footer, but the card is the surface an instance pays the branding off. Card.Root now renders it behind renderBranding, defaulting to on:

<Card.Root renderBranding={false}></Card.Root>

The mark lands as the card's last child and carries no cl- slot of its own. It is Clerk's signature rather than part of the card an app dresses, so there is deliberately nothing here for appearance.elements to reach: an instance turns the mark off by paying the branding off, not by styling it away.

The Mosaic UserButton drops the markup, the styles and the securedBy message, and hands its own answer through to the card. Its branded prop is renamed renderBranding, matching renderTriggerLabel / renderTriggerBadge beside it:

const { renderBranding } = useUserButtonContext();
<Card.Root style={{ rowGap: 0 }} renderBranding={renderBranding} />

Where that answer comes from is unchanged: the connected controller reads displayConfig.branded. The popup's DOM is unchanged too — the mark was already the card's last child, by way of the footer.

Swingset's Card prop table picks renderBranding up as a boolean row with a live toggle in the playground.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

The card is the surface an instance pays the branding off, so `Card.Root` renders the "Secured by Clerk" mark itself behind `renderBranding`, defaulting to on. The UserButton drops the markup, the styles and the message, and hands its own answer — read off `displayConfig.branded` by the controller — straight to the card.
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview Aug 12, 2026 3:18pm
swingset Ready Ready Preview Aug 12, 2026 3:18pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 80d2fa3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9416

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9416

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9416

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9416

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9416

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9416

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9416

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9416

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9416

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9416

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9416

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9416

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9416

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9416

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9416

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9416

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9416

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9416

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9416

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9416

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9416

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9416

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9416

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9416

commit: 80d2fa3

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-08-12T15:19:15.228Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 80d2fa3.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e4bee23a-54a0-4bec-b9db-a8d88f57e050

📥 Commits

Reviewing files that changed from the base of the PR and between 57c5f38 and 80d2fa3.

📒 Files selected for processing (2)
  • packages/ui/src/mosaic/components/card/card.test.tsx
  • packages/ui/src/mosaic/components/card/card.tsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/clerk-ios (auto-detected)
  • clerk/cli (auto-detected)
  • clerk/clerk-android (auto-detected)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/ui/src/mosaic/components/card/card.tsx
  • packages/ui/src/mosaic/components/card/card.test.tsx

📝 Walkthrough

Walkthrough

Card.Root now owns optional “Secured by Clerk” branding. Branding is enabled by default and controlled by renderBranding. UserButtonPopup forwards this option to Card.Root. UserButton footer branding markup, styles, and messages were removed. Tests cover branding placement, accessibility, link attributes, and suppression.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: austincalvelage, maxyinger

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main refactor: branding moves from the UserButton to the Mosaic Card.
Description check ✅ Passed The description accurately explains the Card.Root branding behavior, UserButton changes, prop rename, and Swingset update.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/user-button/user-button.types.ts (1)

135-142: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the deprecated branded input.

Removing branded makes existing callers with branded: false fall through to Card.Root with renderBranding undefined. Card.Root then defaults branding to true, so paid instances show branding again. Retain branded as a deprecated alias and normalize it to renderBranding, with renderBranding taking precedence.

  • packages/ui/src/mosaic/user-button/user-button.types.ts#L135-L142: retain branded?: boolean as a deprecated compatibility prop.
  • packages/ui/src/mosaic/user-button/user-button.view.tsx#L1002-L1011: resolve the legacy value before passing renderBranding to Card.Root.
  • packages/ui/src/mosaic/user-button/__tests__/user-button.view.test.tsx#L641-L650: add a regression case for branded: false.

As per coding guidelines: “Do not remove or rename APIs still called by older SDKs.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/mosaic/user-button/user-button.types.ts` around lines 135 -
142, Preserve the deprecated branded compatibility prop in
packages/ui/src/mosaic/user-button/user-button.types.ts:135-142, marking it
deprecated. In
packages/ui/src/mosaic/user-button/user-button.view.tsx:1002-1011, normalize
branded into the Card.Root renderBranding value, with an explicitly provided
renderBranding taking precedence. In
packages/ui/src/mosaic/user-button/__tests__/user-button.view.test.tsx:641-650,
add regression coverage confirming branded: false prevents branding.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/mosaic-card-owns-branding.md:
- Around line 1-2: Add a Changesets release entry in
mosaic-card-owns-branding.md for packages/ui, specifying the appropriate version
bump for the exported CardProps and Card.Root changes and a concise release note
describing those API/output changes; do not leave the changeset front matter
empty.

---

Outside diff comments:
In `@packages/ui/src/mosaic/user-button/user-button.types.ts`:
- Around line 135-142: Preserve the deprecated branded compatibility prop in
packages/ui/src/mosaic/user-button/user-button.types.ts:135-142, marking it
deprecated. In
packages/ui/src/mosaic/user-button/user-button.view.tsx:1002-1011, normalize
branded into the Card.Root renderBranding value, with an explicitly provided
renderBranding taking precedence. In
packages/ui/src/mosaic/user-button/__tests__/user-button.view.test.tsx:641-650,
add regression coverage confirming branded: false prevents branding.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 83c53995-206d-46cf-8e7f-ed80deff26fd

📥 Commits

Reviewing files that changed from the base of the PR and between 434ca94 and 57c5f38.

📒 Files selected for processing (10)
  • .changeset/mosaic-card-owns-branding.md
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/card/card.styles.ts
  • packages/ui/src/mosaic/components/card/card.test.tsx
  • packages/ui/src/mosaic/components/card/card.tsx
  • packages/ui/src/mosaic/user-button/__tests__/user-button.view.test.tsx
  • packages/ui/src/mosaic/user-button/user-button.messages.ts
  • packages/ui/src/mosaic/user-button/user-button.styles.ts
  • packages/ui/src/mosaic/user-button/user-button.types.ts
  • packages/ui/src/mosaic/user-button/user-button.view.tsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/clerk-ios (auto-detected)
  • clerk/cli (auto-detected)
  • clerk/clerk-android (auto-detected)
💤 Files with no reviewable changes (2)
  • packages/ui/src/mosaic/user-button/user-button.styles.ts
  • packages/ui/src/mosaic/user-button/user-button.messages.ts

Comment on lines +1 to +2
---
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add a release entry for packages/ui.

This PR changes the exported CardProps API and Card.Root output. The empty changeset will not describe or schedule that package change. Add the appropriate package version and release note.

As per coding guidelines: “Use Changesets for version management and changelogs.” Based on learnings: empty changesets are acceptable for documentation-only or non-published changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/mosaic-card-owns-branding.md around lines 1 - 2, Add a Changesets
release entry in mosaic-card-owns-branding.md for packages/ui, specifying the
appropriate version bump for the exported CardProps and Card.Root changes and a
concise release note describing those API/output changes; do not leave the
changeset front matter empty.

Sources: Coding guidelines, Learnings

The mark is Clerk's own signature, not something an app dresses, so it carries no `cl-` slot for `appearance.elements` to reach.
@alexcarpenter
alexcarpenter enabled auto-merge (squash) August 12, 2026 15:24
@alexcarpenter
alexcarpenter merged commit c4131bd into main Aug 12, 2026
54 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card-branding branch August 12, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants