Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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 `<Icon />` component by alexcarpenter · Pull Request #8894 · clerk/javascript · GitHub
Skip to content

feat(ui): Mosaic <Icon /> component - #8894

Merged
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon
Jun 18, 2026
Merged

feat(ui): Mosaic <Icon /> component#8894
alexcarpenter merged 4 commits into
mainfrom
carp/mosaic-icon

Conversation

@alexcarpenter

@alexcarpenteralexcarpenter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

Adds a Mosaic <Icon name="…" /> component and an appearance.icons override mechanism on MosaicProvider.

<Iconname="chevron-right"size="lg"/>

Override any glyph per name via the existing appearance prop:

import{Camera}from'lucide-react';<MosaicProviderappearance={{icons: {'chevron-right': p=><Camera{...p}/>}}}/>

Details

  • Icon component (packages/ui/src/mosaic/components/icon.tsx) — slot recipe with a size variant (sm/md/lg); color inherits via currentColor. Renders a named glyph from a curated registry.
  • Curated glyph set (mosaic/icons/registry.tsx) — small name → glyph map; name is typed from its keys. Grown on demand.
  • appearance.icons (mosaic/appearance.ts, MosaicProvider.tsx) — global per-name overrides. Mosaic's resolved styling (sizing/color) is applied to an override exactly as to the built-in glyph (serialized to a className via Emotion's ClassNames, since overrides are authored outside the Emotion JSX pragma), and the override also receives data-cl-slot="icon" so it stays targetable.
  • Tests — 5 unit tests covering default render, override, styling consistency, and fall-through.
  • Swingset docsicon.stories.tsx + icon.mdx, wired into the registry and docs viewer (Playground, Sizes, Names, Override examples).

Notes

  • Tree-shaking: the string-name API uses a runtime map, so glyphs in the registry bundle once <Icon> is used. The set is kept small to bound this.
  • Empty changeset — the only published surface (@clerk/ui) change is additive/experimental Mosaic; swingset is private.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added an Icon component with built-in glyphs and size variants (sm, md, lg).
    • Enabled per-icon glyph overrides via appearance.icons, allowing consumers to fully replace a glyph while retaining the expected icon slot styling.
  • Documentation

    • Added Icon docs and examples (Playground, props, size/name variants, and override walkthrough).
    • Updated the docs viewer to include the new Icon documentation page.
  • Tests

    • Added coverage for default rendering, overrides (including styling behavior), and fallback when an override doesn’t match the requested icon.

@changeset-bot

changeset-botBot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 153b98c

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

@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 11:26am
swingsetReadyReadyPreview, CommentJun 18, 2026 11:26am

Request Review

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

Review profile: CHILL

Plan: Pro

Run ID: d14af17b-9a53-4b14-8619-b0534bb28b54

📥 Commits

Reviewing files that changed from the base of the PR and between e9aaa50 and d5a5089.

📒 Files selected for processing (1)
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui/src/mosaic/tests/icon.test.tsx

📝 Walkthrough

Walkthrough

Adds a Mosaic Icon component backed by a five-glyph SVG registry (chevron-right, chevron-left, chevron-down, check, close). Introduces an appearance-based per-icon override system via new context types and a MosaicIconsProvider wired into MosaicProvider. Registers icon Swingset stories and MDX docs. Adds a Vitest test suite and a changeset entry.

Changes

Mosaic Icon Component

Layer / File(s)Summary
SVG icon registry and glyph factory
packages/ui/src/mosaic/icons/registry.tsx
glyph() factory produces ref-forwarding SVG wrappers; shared strokeProps and five concrete icons are exported as iconRegistry with IconName union type.
Icon override types, context, and hook
packages/ui/src/mosaic/appearance.ts
Adds MosaicIconRenderProps, MosaicIconRenderer, MosaicIconOverrides types; extends MosaicAppearance.icons; creates MosaicIconsContext, MosaicIconsProvider, and useMosaicIcons hook.
Icon component: recipe, props, and render logic
packages/ui/src/mosaic/components/icon.tsx
Defines iconRecipe with sm/md/lg variants, registers icon slot, exports IconProps, and implements Icon forwardRef that resolves either a built-in glyph or an Emotion-serialized consumer override.
MosaicProvider: wire MosaicIconsProvider
packages/ui/src/mosaic/MosaicProvider.tsx
Memoizes icons from appearance?.icons and adds MosaicIconsProvider wrapping CacheProvider and children.
Icon component tests
packages/ui/src/mosaic/__tests__/icon.test.tsx
Vitest/RTL suite covering default glyph rendering with data-cl-slot="icon", override replacement, override slot attributes and Emotion className, appearance.elements.icon styling on overrides, and fall-through behavior.
Swingset stories, MDX docs, and registry wiring
packages/swingset/src/stories/icon.stories.tsx, packages/swingset/src/stories/icon.mdx, packages/swingset/src/lib/registry.ts, packages/swingset/src/components/DocsViewer.tsx, .changeset/mosaic-icon.md
Four stories (Default, Sizes, Names, Override); full MDX docs page (Playground, Props, Usage, Examples, Override); iconModule added to registry; icon slug wired in DocsViewer; changeset entry added.

Sequence Diagram(s)

sequenceDiagram
participant App as App / Consumer
participant MosaicProvider
participant MosaicIconsProvider
participant Icon
participant useMosaicIcons
participant iconRegistry
App->>MosaicProvider: appearance.icons = { "chevron-right": CustomSVG }
MosaicProvider->>MosaicIconsProvider: provide icons map
App->>Icon: name="chevron-right", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>Icon: serialize iconRecipe → Emotion className
Icon-->>App: CustomSVG(className, data-cl-slot="icon")
App->>Icon: name="chevron-left", size="md"
Icon->>useMosaicIcons: get icons from context
useMosaicIcons-->>Icon: { "chevron-right": CustomSVG }
Icon->>iconRegistry: lookup "chevron-left"
iconRegistry-->>Icon: built-in glyph SVG
Icon-->>App: SVG glyph with recipe props
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8755: Both PRs modify packages/ui/src/mosaic/MosaicProvider.tsx, with the retrieved PR adding the base MosaicProvider/useMosaicTheme implementation while the main PR further extends MosaicProvider to compute and provide icon overrides via a new MosaicIconsProvider.
  • clerk/javascript#8818: The main PR's @clerk/swingset icon pages are wired into the same packages/swingset/src/lib/registry.ts/DocsViewer.tsx single-page docs+sidebar plumbing (adding an iconModule entry that relies on the revamped module resolution), so it's directly related to the retrieved explorer revamp PR.
  • clerk/javascript#8819: Both PRs touch the same swingset module-wiring code—DocsViewer's docModules and packages/swingset/src/lib/registry.ts entries to register new MDX/story pages (main PR adds icon, retrieved PR adds headless primitives)—so they're related at the registry/DocsViewer integration points.

Suggested reviewers

  • kylemac

🐇 Hoppity hop, an Icon appears,
Five glyphs now dance through the code frontiers!
Override a chevron with your own SVG art,
MosaicProvider wires it straight to the heart.
currentColor sings and className gleams—
Little rabbit approves this icon scheme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 28.57% 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 accurately summarizes the main change: introducing a new Mosaic Icon component to the UI package with all supporting infrastructure.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actionsBot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-06-18T11:27:53.181Z

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 153b98c.

Adds <Icon name="..." /> rendering from a named glyph set, with per-name
overrides via appearance.icons on MosaicProvider. Mosaic's sizing/color is
applied to overrides so swapped glyphs stay visually consistent. Includes
swingset docs.
@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@8894

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 153b98c

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

Caution

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

⚠️ Outside diff range comments (1)
packages/ui/src/mosaic/__tests__/icon.test.tsx (1)

1-58: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Prettier formatting in this test file before merge.

format:check is failing for @clerk/ui, and this file is reported by CI. Please run Prettier on this file to unblock the pipeline.

As per coding guidelines, **/*.{js,jsx,ts,tsx,json,md,yml,yaml,css} must use Prettier for code formatting.

🤖 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/__tests__/icon.test.tsx` around lines 1 - 58, The test
file icon.test.tsx has Prettier formatting violations that are causing the
format:check CI check to fail. Run Prettier on this file to automatically format
it according to the project's coding guidelines for TypeScript/TSX files. Use
your project's Prettier configuration to ensure the formatting is consistent
with the rest of the codebase.

Sources: Coding guidelines, Pipeline failures

🧹 Nitpick comments (1)
packages/swingset/src/stories/icon.stories.tsx (1)

23-25: ⚡ Quick win

Add explicit return types to story/helper functions.

Line 23, Line 27, Line 36, Line 58, and Line 80 define functions without explicit return types. Please annotate them (for example, knobsAsProps(...): IconProps and story exports as : React.ReactElement) to match the TS guideline.

Suggested patch
+import type { ReactElement } from 'react';+-function knobsAsProps(props: Record<string, unknown>) {+function knobsAsProps(props: Record<string, unknown>): IconProps {
return props as unknown as IconProps;
}
-export function Default(props: Record<string, unknown>) {+export function Default(props: Record<string, unknown>): ReactElement {
return (
<Icon
{...knobsAsProps(props)}
name='chevron-right'
/>
);
}
-export function Sizes(props: Record<string, unknown>) {+export function Sizes(props: Record<string, unknown>): ReactElement {
return (
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
...
</div>
);
}
-export function Names() {+export function Names(): ReactElement {
return (
<div style={{ display: 'flex', gap: 16, alignItems: 'center', flexWrap: 'wrap' }}>
...
</div>
);
}
-export function Override() {+export function Override(): ReactElement {
return (
<MosaicProvider
...

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

Also applies to: 27-34, 36-56, 58-75, 80-107

🤖 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/icon.stories.tsx` around lines 23 - 25, Add
explicit return type annotations to all functions in the file that currently
lack them. The knobsAsProps helper function should be annotated with a return
type of IconProps. All story export functions (the ones defining stories) should
be annotated with a return type of React.ReactElement to comply with the
TypeScript coding guideline requiring explicit return types on all public APIs
and helper functions. Update the function declarations at lines 23, 27, 36, 58,
and 80 as well as any other functions in the mentioned ranges to include their
explicit return types.

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/__tests__/icon.test.tsx`:
- Around line 40-47: The assertion in the test function that checks overridden
glyph styling is too weak; it only verifies that className is truthy but does
not validate that the appearance.elements.icon configuration with opacity: 0.5
is actually applied. Replace the assertion on getByTestId('override').className
with a stronger check that verifies the specific styling from
appearance.elements.icon is present, such as checking computed styles for the
opacity value or asserting that a class corresponding to the opacity styling is
present in the className.
In `@packages/ui/src/mosaic/components/icon.tsx`:
- Around line 51-55: The override function is receiving the user-provided
className instead of the merged recipe styling because the spread operator rest
is applied after the className property is set on line 54, allowing any
className in rest to overwrite the computed value. Move the spread operator rest
to come before the className property definition in the override function call,
so that the merged className from emotion.cx (combining the recipe styling with
root.className) takes precedence and is not overwritten by a user-provided
className in rest props.
- Around line 40-53: The Icon component forwards an SVGSVGElement ref to
override renderers that may return non-SVG elements, causing a type safety
issue. Remove the ref prop from the override function call in the MosaicIcon
function (where override is invoked with ref, data-cl-slot, and other props),
and update the MosaicIconRenderProps type definition in appearance.ts to use
React.ComponentPropsWithoutRef<'svg'> instead of including a ref property. This
ensures the ref contract matches the actual element types that can be returned
by overrides.
---
Outside diff comments:
In `@packages/ui/src/mosaic/__tests__/icon.test.tsx`:
- Around line 1-58: The test file icon.test.tsx has Prettier formatting
violations that are causing the format:check CI check to fail. Run Prettier on
this file to automatically format it according to the project's coding
guidelines for TypeScript/TSX files. Use your project's Prettier configuration
to ensure the formatting is consistent with the rest of the codebase.
---
Nitpick comments:
In `@packages/swingset/src/stories/icon.stories.tsx`:
- Around line 23-25: Add explicit return type annotations to all functions in
the file that currently lack them. The knobsAsProps helper function should be
annotated with a return type of IconProps. All story export functions (the ones
defining stories) should be annotated with a return type of React.ReactElement
to comply with the TypeScript coding guideline requiring explicit return types
on all public APIs and helper functions. Update the function declarations at
lines 23, 27, 36, 58, and 80 as well as any other functions in the mentioned
ranges to include their explicit return types.
🪄 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: f5e72b81-b6df-4efc-b2d0-0ed8e20bbf5f

📥 Commits

Reviewing files that changed from the base of the PR and between f4ecc13 and 91d4ffd.

📒 Files selected for processing (10)
  • .changeset/mosaic-icon.md
  • packages/swingset/src/components/DocsViewer.tsx
  • packages/swingset/src/lib/registry.ts
  • packages/swingset/src/stories/icon.mdx
  • packages/swingset/src/stories/icon.stories.tsx
  • packages/ui/src/mosaic/MosaicProvider.tsx
  • packages/ui/src/mosaic/__tests__/icon.test.tsx
  • packages/ui/src/mosaic/appearance.ts
  • packages/ui/src/mosaic/components/icon.tsx
  • packages/ui/src/mosaic/icons/registry.tsx

Comment threadpackages/ui/src/mosaic/__tests__/icon.test.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx
Comment threadpackages/ui/src/mosaic/components/icon.tsx Outdated

@kylemackylemac 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.

mostly reviewed the documentation and 👍

- Don't forward the SVGSVGElement ref to icon overrides (which may render non-svg); type MosaicIconRenderProps as ComponentPropsWithoutRef<'svg'>.
- Spread ...rest before the Mosaic-controlled props so a user className can't clobber the recipe styling.
- Strengthen the elements.icon test to assert the opacity styling is actually inserted.
@alexcarpenter
alexcarpenter merged commit 7987e8a into mainJun 18, 2026
47 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-icon branch June 18, 2026 13:54
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