Skip to content

feat(ui): scale Mosaic Item rows from a single size prop - #9297

Merged
alexcarpenter merged 3 commits into
mainfrom
carp/mosaic-item-revisions
Jul 31, 2026
Merged

feat(ui): scale Mosaic Item rows from a single size prop#9297
alexcarpenter merged 3 commits into
mainfrom
carp/mosaic-item-revisions

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

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

Item.Root takes a size (xs | md, default md) that fixes the row's height and gap, and provides it through context so Item.Media derives its column width from the row rather than taking a size of its own. A row scales as one unit instead of needing the prop set on two parts that can drift apart. Item.Media reflects the resolved value as data-size alongside the root, and falls back to the default when rendered outside a root.

This replaces the entity/action variant, which conflated visual treatment with density. Action rows now use a dedicated Item.Label part in place of Item.Title — dimmed until the row is hovered, so it reads as an affordance rather than content. Item.Header, Item.HeaderTitle, and Item.HeaderActions are removed; they had no consumers in the monorepo.

Because media is now sized by the row, its child should fill the column (Avatar.Root size='fit', or an icon at width='100%') rather than carry a fixed pixel size that won't track size. The swingset page and JSDoc are updated to match, and the Item.Label component had been declared under a duplicated MosaicItemDescription name, which is corrected.

The changeset is empty: Mosaic is not yet part of the public @clerk/ui surface, matching the existing mosaic-item and mosaic-button-variants changesets.

Checklist

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

Type of change

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

Item.Root now takes size (xs | md), fixing the row height and gap, and
provides it through context so Item.Media derives its column width instead
of taking a size of its own.

Replaces the entity/action variant, adds Item.Label for action rows, and
drops Item.Header/HeaderTitle/HeaderActions, which had no consumers.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview Jul 31, 2026 12:03am
swingset Ready Ready Preview Jul 31, 2026 12:03am

Request Review

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d47e2da

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the ui label Jul 30, 2026
@vercel
vercel Bot temporarily deployed to Preview – clerk-js-sandbox July 30, 2026 23:47 Inactive
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: c9d6f3b5-d6ce-4d6c-ac05-73a906dc5869

📥 Commits

Reviewing files that changed from the base of the PR and between fa09923 and d47e2da.

📒 Files selected for processing (3)
  • packages/ui/src/mosaic/components/item/item.markers.stylex.ts
  • packages/ui/src/mosaic/components/item/item.styles.ts
  • packages/ui/src/mosaic/components/item/item.tsx
🔗 Linked repositories identified

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

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)

📝 Walkthrough

Walkthrough

The Item component now uses root-level size values with context-driven media sizing, adds Item.Label, and removes header-related exports. Styles support xs and md variants, responsive media dimensions, truncation, and updated focus treatment. Tests cover size propagation and defaults. Stories and documentation describe the new API and examples, and a spacing token plus Changesets metadata were added.

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

Possibly related PRs

  • clerk/javascript#9234: Directly related Mosaic Item component, styling, test, and documentation changes.

Suggested reviewers: maxyinger

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: consolidating Mosaic Item row sizing under a single size prop.
Description check ✅ Passed The description directly explains the sizing changes, API updates, component removals, styling behavior, and documentation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

❤️ Share

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

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-31T00:04:11.157Z

Summary

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

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on d47e2da.

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: d47e2da

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/ui/src/mosaic/components/item/item.test.tsx (1)

94-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the new Item.Label part.

The "composed slots" test checks Item.Title, Item.Description, and Item.Actions classes but doesn't exercise Item.Label, the new component introduced in this PR. As per coding guidelines, "Unit tests are required for all new functionality" / "Include tests for all new features."

✅ Suggested addition
     <Item.Actions>
       <button type='button'>Manage</button>
     </Item.Actions>
+    <Item.Label>Sign out</Item.Label>
   </Item.Root>,
 );
 expect(screen.getByText('Test Organization')).toHaveClass('cl-item-title');
 expect(screen.getByText('Member')).toHaveClass('cl-item-description');
 expect(screen.getByRole('button', { name: 'Manage' }).parentElement).toHaveClass('cl-item-actions');
+expect(screen.getByText('Sign out')).toHaveClass('cl-item-label');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/mosaic/components/item/item.test.tsx` around lines 94 - 109,
The composed-slots test does not cover the new Item.Label component. Update the
test around the existing Item.Root composition to render Item.Label with
representative text and assert it has the expected stable label class, while
preserving the existing Title, Description, and Actions assertions.

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/swingset/src/stories/item.stories.tsx`:
- Around line 195-218: Update the icon-only Button in the story to provide an
accessible name describing its more-options action, using an appropriate
aria-label or equivalent accessible labeling mechanism; keep the SVG decorative
or otherwise prevent it from being announced redundantly.

---

Nitpick comments:
In `@packages/ui/src/mosaic/components/item/item.test.tsx`:
- Around line 94-109: The composed-slots test does not cover the new Item.Label
component. Update the test around the existing Item.Root composition to render
Item.Label with representative text and assert it has the expected stable label
class, while preserving the existing Title, Description, and Actions assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: a6da41b6-6884-4b21-bd02-522dc42c9f19

📥 Commits

Reviewing files that changed from the base of the PR and between b0519d2 and fa09923.

📒 Files selected for processing (7)
  • .changeset/mosaic-item-size.md
  • packages/swingset/src/stories/item.mdx
  • packages/swingset/src/stories/item.stories.tsx
  • packages/ui/src/mosaic/components/item/item.styles.ts
  • packages/ui/src/mosaic/components/item/item.test.tsx
  • packages/ui/src/mosaic/components/item/item.tsx
  • packages/ui/src/mosaic/tokens.stylex.ts
🔗 Linked repositories identified

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

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)

Comment thread packages/swingset/src/stories/item.stories.tsx
Item.Label reacted to :hover on its own text, so the color only promoted when
the pointer was over the label itself rather than anywhere in the row.

Adds an itemScope marker applied by Item.Root and keys the label color to
stylex.when.ancestor against it, so the scope cannot be triggered by an
unrelated hovered ancestor.

@maxyinger maxyinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👏 lets 👏 go 👏

@alexcarpenter
alexcarpenter merged commit 49d61ff into main Jul 31, 2026
52 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-item-revisions branch July 31, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants