Skip to content

feat(ui): add Mosaic Badge component - #9221

Open
alexcarpenter wants to merge 8 commits into
mainfrom
carp/mosaic-badge
Open

feat(ui): add Mosaic Badge component#9221
alexcarpenter wants to merge 8 commits into
mainfrom
carp/mosaic-badge

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Jul 22, 2026

Copy link
Copy Markdown
Member

Adds Mosaic Badge. StyleX, span root, one intent axis: primary | secondary | warning | destructive | success.

Preview: https://swingset-git-carp-mosaic-badge.clerkstage.dev/components/badge

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 890fc06

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

@github-actions github-actions Bot added the ui label Jul 22, 2026
@vercel

vercel Bot commented Jul 22, 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, Comment Jul 27, 2026 7:58pm
swingset Ready Ready Preview, Comment Jul 27, 2026 7:58pm

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 890fc06

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-27T20:00:20.637Z

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 890fc06.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 1a067362-e41a-4ab7-8050-fd436b9cfd33

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4e83b and 890fc06.

📒 Files selected for processing (3)
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/badge.mdx
  • packages/ui/src/mosaic/components/badge/badge.styles.ts
🔗 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)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/ui/src/mosaic/components/badge/badge.styles.ts
  • packages/swingset/src/stories/badge.mdx
  • packages/swingset/src/lib/registry.ts

📝 Walkthrough

Walkthrough

Adds a new Mosaic Badge component with color variants, StyleX styling and tokens, forwarded props and refs, tests, Storybook stories, and MDX documentation. Registers the component in Swingset, exposes its public exports, updates PropTable rendering, externalizes headless packages, updates button color tokens, and adds a changeset.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding the Mosaic Badge component.
Description check ✅ Passed The description is related to the Badge component work, even though some prop names are stale.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 3

🤖 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-badge.md:
- Around line 1-2: Replace the empty frontmatter in mosaic-badge.md with a
changeset entry for `@clerk/ui` using a minor release level, preserving the
required changeset format so the new public Badge component and props API
generate a package bump and changelog entry.

In `@packages/swingset/src/stories/badge.stories.tsx`:
- Around line 1-2: Add the required top-level Emotion JSX import-source pragma
to the badge story before its imports, while preserving the existing BadgeProps
and Badge imports.

In `@packages/ui/src/mosaic/components/badge/badge.tsx`:
- Around line 18-19: Update the Badge component’s prop spread order so rest
props are applied before the component-owned themeProps result, preventing
consumers from overriding the resolved intent metadata. Preserve the existing
style and className resolution, and add a regression test covering an intent
such as success with conflicting rest metadata to verify the resolved intent
wins.
🪄 Autofix (Beta)

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: f2fefe08-7668-4d38-97b4-36691ea6f821

📥 Commits

Reviewing files that changed from the base of the PR and between 68ae308 and e5fb0a1.

📒 Files selected for processing (11)
  • .changeset/mosaic-badge.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/badge.mdx
  • packages/swingset/src/stories/badge.stories.tsx
  • packages/ui/src/mosaic/components/badge/badge.styles.ts
  • packages/ui/src/mosaic/components/badge/badge.test.tsx
  • packages/ui/src/mosaic/components/badge/badge.tsx
  • packages/ui/src/mosaic/components/badge/index.ts
  • packages/ui/src/mosaic/styles/index.ts
  • packages/ui/src/mosaic/tokens.stylex.ts
🔗 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)

Comment thread .changeset/mosaic-badge.md
Comment on lines +1 to +2
import type { BadgeProps } from '@clerk/ui/mosaic/components/badge';
import { Badge } from '@clerk/ui/mosaic/components/badge';

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 | 🟡 Minor | ⚡ Quick win

Add the required Emotion JSX pragma.

This story renders a styled Mosaic component but lacks the required top-level @jsxImportSource pragma.

+/** `@jsxImportSource` `@emotion/react` */
+
 import type { BadgeProps } from '`@clerk/ui/mosaic/components/badge`';

As per coding guidelines, “Use Emotion pragma /** @jsxImportSource @emotion/react */ at the top of story files that render styled Mosaic components.”

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { BadgeProps } from '@clerk/ui/mosaic/components/badge';
import { Badge } from '@clerk/ui/mosaic/components/badge';
/** `@jsxImportSource` `@emotion/react` */
import type { BadgeProps } from '`@clerk/ui/mosaic/components/badge`';
import { Badge } from '`@clerk/ui/mosaic/components/badge`';
🤖 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/swingset/src/stories/badge.stories.tsx` around lines 1 - 2, Add the
required top-level Emotion JSX import-source pragma to the badge story before
its imports, while preserving the existing BadgeProps and Badge imports.

Source: Coding guidelines

Comment thread packages/ui/src/mosaic/components/badge/badge.tsx Outdated

@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

🤖 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 `@packages/ui/src/mosaic/components/badge/badge.styles.ts`:
- Around line 34-43: Update the warning and success variants in the badge styles
to meet at least 4.5:1 contrast for label-sm text in light and dark themes,
using appropriate contrast-paired foreground tokens or adjusted faded fills
while leaving destructive unchanged. Add contrast tests covering warning in
light mode and success in dark mode.
🪄 Autofix (Beta)

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: 359f20ad-7b5b-46fc-9c96-2cef54c7e062

📥 Commits

Reviewing files that changed from the base of the PR and between e5fb0a1 and 173b95d.

📒 Files selected for processing (2)
  • packages/ui/src/mosaic/components/badge/badge.styles.ts
  • packages/ui/src/mosaic/tokens.stylex.ts
🔗 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)

Comment thread packages/ui/src/mosaic/components/badge/badge.styles.ts Outdated
- values: secondary→neutral, destructive→negative, success→positive
- swingset PropTable: sx row now opt-out (Badge is StyleX, no sx)
- docs: document render prop

@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

🤖 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 `@packages/ui/src/mosaic/tokens.stylex.ts`:
- Around line 29-44: Restore the deprecated --cl-color-destructive* and
--cl-color-muted* aliases in the exported colorVars alongside the replacement
negative and neutral tokens. Map each alias to its corresponding current token,
preserving compatibility for existing SDK styles and consumer customizations.
🪄 Autofix (Beta)

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: d6a66e4b-7245-437c-97f3-09c71b4ce92f

📥 Commits

Reviewing files that changed from the base of the PR and between 173b95d and 5406ee6.

📒 Files selected for processing (13)
  • .changeset/mosaic-badge.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/components/PropTable.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/badge.mdx
  • packages/swingset/src/stories/badge.stories.tsx
  • packages/ui/src/mosaic/components/badge/badge.styles.ts
  • packages/ui/src/mosaic/components/badge/badge.test.tsx
  • packages/ui/src/mosaic/components/badge/badge.tsx
  • packages/ui/src/mosaic/components/badge/index.ts
  • packages/ui/src/mosaic/styles/index.ts
  • packages/ui/src/mosaic/tokens.stylex.ts
  • packages/ui/tsdown.mosaic.config.mts
🔗 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)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/ui/src/mosaic/components/badge/index.ts
  • packages/ui/src/mosaic/styles/index.ts
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/stories/badge.mdx
  • packages/swingset/src/lib/registry.ts

Comment thread packages/ui/src/mosaic/tokens.stylex.ts
@vercel
vercel Bot temporarily deployed to Preview – clerk-js-sandbox July 27, 2026 19:55 Inactive
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.

1 participant