Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); feat(ui): Mosaic `<Card />` component scaffolding by alexcarpenter · Pull Request #8893 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Card /> component scaffolding - #8893

Merged
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card
Jun 18, 2026
Merged

feat(ui): Mosaic <Card /> component scaffolding#8893
alexcarpenter merged 8 commits into
mainfrom
carp/mosaic-card

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Scaffolds new Mosaic <Card /> component

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

Introduces component contexts to supply defaults for slots.

<Card.Header><Heading>Hello world</Heading><Text>This is a description</Text><-defaultsto{intent: 'mutedForeground'}</Card.Header>

due to <TextContext.Provider value={{ intent: 'mutedForeground' }}> usage https://github.com/clerk/javascript/pull/8893/changes#diff-995e269e94151b9b4203bd0881168e3efa678d79930d0225f58aaae1476a7ac1R83

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:

Summary by CodeRabbit

  • New Features

    • Introduced the Card component with Header, Content, and Footer, including alignment support.
    • Added a fullWidth styling variant to the Button component.
    • Extended the theme with new card and card foreground color tokens.
    • Added Card documentation with interactive examples, and surfaced it in the docs viewer navigation.
  • Refactor / UX Improvements

    • Updated Heading and Text to support context-driven prop defaults.
    • Improved DialogContent handling for non-render-function children.

@vercel

vercelBot commented Jun 17, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJun 18, 2026 3:08pm
swingsetReadyReadyPreview, CommentJun 18, 2026 3:08pm

Request Review

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 12f8239

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

@coderabbitai

coderabbitaiBot commented Jun 17, 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f019a848-d5f7-4d67-b28b-45a463a45c0d

📥 Commits

Reviewing files that changed from the base of the PR and between 33ea060 and 12f8239.

📒 Files selected for processing (1)
  • .changeset/some-towns-study.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/some-towns-study.md

📝 Walkthrough

Walkthrough

Adds a new Mosaic Card component with a slot recipe (root, header, content, footer) and an alignment variant. Introduces a useContextProps utility hook used by Text and Heading for context-driven prop resolution. Adds a fullWidth boolean variant to Button, card color tokens to the theme, and registers a Card docs page in the Swingset storybook.

Changes

Mosaic Card Component and Supporting Infrastructure

Layer / File(s)Summary
useContextProps hook
packages/ui/src/mosaic/utils/context.ts
New useContextProps<T> hook merges a React context value with incoming props, using props as the override source for any defined fields.
Card theme tokens
packages/ui/src/mosaic/variables.ts
Adds color.card and color.cardForeground to defaultMosaicVariables, expanding the inferred MosaicTokens/MosaicTheme types. Reformats merge() guard logic to explicit if/continue blocks.
TextContext and HeadingContext
packages/ui/src/mosaic/components/text.tsx, packages/ui/src/mosaic/components/heading.tsx
Exports new TextContext and HeadingContext React contexts; updates Text and Heading to resolve props via useContextProps instead of reading incoming props directly.
Button fullWidth variant
packages/ui/src/mosaic/components/button.tsx
Adds a fullWidth boolean variant to buttonRecipe (applying width: 100% when true), sets fullWidth: false in defaultVariants, and updates Button to forward it into recipe variant selection.
Card component
packages/ui/src/mosaic/components/card.tsx
Introduces cardRecipe with root/header/content/footer slots and an alignment variant. Exports Card with Card.Root, Card.Header (wraps children in TextContext.Provider with intent: 'mutedForeground'), Card.Content, and Card.Footer subcomponents via forwardRef.
DialogContent non-function children guard
packages/ui/src/mosaic/components/dialog.tsx
Expands the children type guard in DialogContent to return children directly when it is not a render function, before calling it as a render prop.
Swingset Card docs and stories
packages/swingset/src/stories/card.component.stories.tsx, packages/swingset/src/stories/card.component.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/some-towns-study.md
Adds Default and Centered story renderers with full-width buttons; an MDX page with Preview, PropTable, usage snippet, and Examples section; wires the Card module into the registry and DocsViewer doc module map; and documents the feature in a changeset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Introduces the Mosaic token/theme variable system that this PR extends with color.card and color.cardForeground tokens.
  • clerk/javascript#8809: Both PRs extend DocsViewer.tsxdocModules and packages/swingset/src/lib/registry.ts to register a new component documentation module.
  • clerk/javascript#8891: This PR exports __source via card.component.stories?raw, which is consumed by the retrieved PR's StoryEmbed/code-footer system.

Suggested reviewers

  • kylemac

🐇 A card with a header and footer so neat,
With slots and alignment — what a feat!
TextContext whispers props through the tree,
fullWidth buttons spread wide and free.
The rabbit stamps the registry with glee! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 14.29% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title 'feat(ui): Mosaic <Card /> component scaffolding' accurately and specifically describes the main change—introducing a new Card component to the Mosaic UI library with foundational implementation.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@pkg-pr-new

pkg-pr-newBot commented Jun 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 12f8239

@alexcarpenter
alexcarpenter marked this pull request as ready for review June 17, 2026 17:40
@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T15:10:25.307Z

Summary

MetricCount
Packages analyzed19
Packages with changes0
🔴 Breaking changes0
🟡 Non-breaking changes0
🟢 Additions0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 12f8239.

@coderabbitaicoderabbitaiBot 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

🧹 Nitpick comments (4)
packages/ui/src/mosaic/components/dialog.tsx (1)

130-136: ⚡ Quick win

Add explicit return type to DialogContent for consistency with other components in this file.

All other internal components (Backdrop, Viewport, Popup) use explicit return types via React.forwardRef<…>(). While DialogContent is internal-only, adding an explicit return type aligns with the file's pattern and satisfies the coding guideline to define explicit return types for functions.

♻️ Proposed fix
-function DialogContent({ children }: { children: DialogProps['children'] }) {+function DialogContent({ children }: { children: DialogProps['children'] }): JSX.Element {
🤖 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/components/dialog.tsx` around lines 130 - 136, The
DialogContent function lacks an explicit return type annotation while other
components in the file like Backdrop, Viewport, and Popup use explicit return
types. Add an explicit return type annotation to the DialogContent function
signature to specify that it returns React.ReactNode or JSX.Element, matching
the consistent pattern used by other internal components in the file.

Source: Coding guidelines

packages/swingset/src/stories/card.component.stories.tsx (1)

43-59: ⚡ Quick win

Make Centered follow the story props contract.

Centered should accept props: Record<string, unknown> and use knobsAsProps, same as other story renderers.

Suggested patch
-export function Centered() {+export function Centered(props: Record<string, unknown>) {+ const knobs = knobsAsProps(props);
return (
<Card
+ {...knobs}
alignment='center'
style={{ maxWidth: 400 }}
>

As per coding guidelines, “Story functions must accept props: Record<string, unknown> and cast to the real prop type via a local knobsAsProps helper.”

🤖 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/card.component.stories.tsx` around lines 43 -
59, The Centered story function does not follow the story props contract
required by the codebase guidelines. Update the Centered function signature to
accept a props parameter of type Record<string, unknown>, use the knobsAsProps
helper to cast the props to the correct Card component type (similar to how
other story renderers in the file are implemented), and then use these casted
props when rendering the Card component instead of hardcoding the alignment and
style values directly.

Source: Coding guidelines

packages/ui/src/mosaic/components/card.tsx (2)

121-121: ⚡ Quick win

Add an explicit return type to exported Card

Please add an explicit return type on the exported API function for consistency with the TypeScript rules used in this repository.

Suggested fix
-export function Card({ alignment, children, ...props }: CardProps) {+export function Card({ alignment, children, ...props }: CardProps): React.JSX.Element {

As per coding guidelines, **/*.{ts,tsx}: “Always define explicit return types for functions, especially public APIs.”

🤖 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/components/card.tsx` at line 121, The exported Card
function is missing an explicit return type annotation. Add a return type to the
Card function signature that specifies what the function returns (typically
JSX.Element or React.ReactElement for React components). This should be added
after the closing parenthesis of the function parameters and before the opening
curly brace of the function body, following TypeScript conventions for public
API functions in this repository.

Source: Coding guidelines


7-8: ⚡ Quick win

Confirm JSDoc coverage for new Card exports

This file introduces new exports (cardRecipe, CardProps, Card). If these are reference-facing, they likely need JSDoc blocks so generated docs don’t drift. If they are internal-only, please clarify so docs requirements can be waived for this surface.

As per coding guidelines, in packages/**/src public/reference-facing APIs should have comprehensive JSDoc, and changes that affect generated docs may need Docs-team review.

Also applies to: 117-121

🤖 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/components/card.tsx` around lines 7 - 8, Add
comprehensive JSDoc blocks to the new Card exports (cardRecipe, CardProps, and
Card) in the card.tsx file. Each export should include a description of its
purpose and any relevant parameter/return type documentation. If these are
internal-only APIs, instead add a comment clarifying their internal-only status.
Ensure all public-facing exports in packages/**/src follow the coding guidelines
for JSDoc documentation.

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 `@packages/ui/src/mosaic/components/card.tsx`:
- Around line 26-46: The `alignment` variant applies `alignItems` CSS property
to the header element in lines 42 and 45, but the header base styles do not
define the header as a flex container, making the alignItems property
ineffective. Add `display: 'flex'` to the base header object (in the root styles
section alongside the padding properties) to make it a flex container so that
the alignItems variant can properly control the alignment of header content.
---
Nitpick comments:
In `@packages/swingset/src/stories/card.component.stories.tsx`:
- Around line 43-59: The Centered story function does not follow the story props
contract required by the codebase guidelines. Update the Centered function
signature to accept a props parameter of type Record<string, unknown>, use the
knobsAsProps helper to cast the props to the correct Card component type
(similar to how other story renderers in the file are implemented), and then use
these casted props when rendering the Card component instead of hardcoding the
alignment and style values directly.
In `@packages/ui/src/mosaic/components/card.tsx`:
- Line 121: The exported Card function is missing an explicit return type
annotation. Add a return type to the Card function signature that specifies what
the function returns (typically JSX.Element or React.ReactElement for React
components). This should be added after the closing parenthesis of the function
parameters and before the opening curly brace of the function body, following
TypeScript conventions for public API functions in this repository.
- Around line 7-8: Add comprehensive JSDoc blocks to the new Card exports
(cardRecipe, CardProps, and Card) in the card.tsx file. Each export should
include a description of its purpose and any relevant parameter/return type
documentation. If these are internal-only APIs, instead add a comment clarifying
their internal-only status. Ensure all public-facing exports in packages/**/src
follow the coding guidelines for JSDoc documentation.
In `@packages/ui/src/mosaic/components/dialog.tsx`:
- Around line 130-136: The DialogContent function lacks an explicit return type
annotation while other components in the file like Backdrop, Viewport, and Popup
use explicit return types. Add an explicit return type annotation to the
DialogContent function signature to specify that it returns React.ReactNode or
JSX.Element, matching the consistent pattern used by other internal components
in the file.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5820d874-ec6e-4be9-9d81-92f565cd98f6

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 3ec67fd.

📒 Files selected for processing (11)
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/card.component.mdx
  • packages/swingset/src/stories/card.component.stories.tsx
  • packages/ui/src/mosaic/components/button.tsx
  • packages/ui/src/mosaic/components/card.tsx
  • packages/ui/src/mosaic/components/dialog.tsx
  • packages/ui/src/mosaic/components/heading.tsx
  • packages/ui/src/mosaic/components/text.tsx
  • packages/ui/src/mosaic/utils/context.ts
  • packages/ui/src/mosaic/variables.ts

Comment threadpackages/ui/src/mosaic/components/card.tsx
@alexcarpenter
alexcarpenter merged commit ef0bb0e into mainJun 18, 2026
49 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-card branch June 18, 2026 15:26
Sign up for freeto 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

@alexcarpenter@kylemac