Skip to content

refactor(ui): Mosaic input component - #9309

Open
austincalvelage wants to merge 14 commits into
mainfrom
austin/mosaic-input-component
Open

refactor(ui): Mosaic input component#9309
austincalvelage wants to merge 14 commits into
mainfrom
austin/mosaic-input-component

Conversation

@austincalvelage

Copy link
Copy Markdown
Member

Description

https://swingset-git-austin-mosaic-input-component.clerkstage.dev/components/input

Updates the Mosaic Input to match the current Figma:

  • Migrates Input styling from Emotion to StyleX.
  • Aligns sizing, typography, padding, radius, borders, surface color, focus treatment, and invalid state with the design.
  • Adds the lg size alongside sm and md.
  • Adds render support for polymorphic composition.
  • Preserves native input props, refs, consumer styling, and data-attribute precedence.
import { Input } from '@clerk/ui/mosaic/components/input';

<Input
  size='md'
  placeholder='Email address'
  aria-invalid='true'
/>;

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

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

Request Review

@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 83a2527

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 31, 2026
@austincalvelage austincalvelage changed the title Mosaic input component refactor(ui): Mosaic input component Jul 31, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 83a2527

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-08-03T20:45:17.845Z

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 83a2527.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The Mosaic Input component now uses StyleX styles and size variants. It supports typed sizes, disabled and invalid states, prop and ref forwarding, custom rendering, and style merging. Public exports and tests were added. Consumers now use inline CSS spacing. The story includes StyleX size metadata and a large example. A placeholder color token and changeset file were added.

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

Possibly related PRs

Suggested reviewers: maxyinger, alexcarpenter

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: refactoring the Mosaic input component.
Description check ✅ Passed The description accurately summarizes the StyleX migration, design updates, sizing changes, polymorphic rendering, and compatibility behavior.
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.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

9-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the public Input API.

Add JSDoc for InputProps and Input. Document the default size and the render customization contract.

As per coding guidelines, “All public APIs must be documented with JSDoc.”

🤖 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/input/input.tsx` around lines 9 - 13,
Document the public InputProps interface and Input component with JSDoc. Include
that size defaults to the established default value and describe the render
customization contract exposed through MosaicComponentProps, including how
custom rendering is used.

Source: Coding guidelines

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

Inline comments:
In `@packages/ui/src/mosaic/components/input/input.styles.ts`:
- Around line 26-30: Update the boxShadow configuration in the input styles so
aria-invalid="true" does not suppress the focus-visible indicator. Remove the
invalid-state overrides or assign them an appropriate focus ring, while
preserving the existing focusRing behavior for keyboard-focused inputs.

In `@packages/ui/src/mosaic/components/input/input.test.tsx`:
- Around line 83-94: Extend the Input tests with a callback-form render case
using render={props => <input {...props} />}. Locate the resulting input by role
and verify the callback output receives the cl-input class and data-size="sm"
attributes, alongside confirming the custom input renders successfully.

---

Nitpick comments:
In `@packages/ui/src/mosaic/components/input/input.tsx`:
- Around line 9-13: Document the public InputProps interface and Input component
with JSDoc. Include that size defaults to the established default value and
describe the render customization contract exposed through MosaicComponentProps,
including how custom rendering is used.
🪄 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: 0c14e9f4-0957-49d6-a990-728ae3ad5de2

📥 Commits

Reviewing files that changed from the base of the PR and between fdadaa2 and 2c5c9e7.

📒 Files selected for processing (12)
  • .changeset/migrate-mosaic-input-to-stylex.md
  • packages/swingset/src/stories/input.stories.tsx
  • packages/ui/src/mosaic/block/destructive.tsx
  • packages/ui/src/mosaic/components/input.tsx
  • packages/ui/src/mosaic/components/input/index.ts
  • packages/ui/src/mosaic/components/input/input.styles.ts
  • packages/ui/src/mosaic/components/input/input.test.tsx
  • packages/ui/src/mosaic/components/input/input.tsx
  • packages/ui/src/mosaic/organization/organization-profile-domains-section-add-verify.view.tsx
  • packages/ui/src/mosaic/organization/organization-profile-profile-section.view.tsx
  • packages/ui/src/mosaic/styles/index.ts
  • packages/ui/src/mosaic/tokens.stylex.ts
🔗 Linked repositories identified

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

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/clerk-ios (auto-detected)
  • clerk/clerk-android (auto-detected)
  • clerk/cli (auto-detected)
💤 Files with no reviewable changes (1)
  • packages/ui/src/mosaic/components/input.tsx

Comment thread packages/ui/src/mosaic/components/input/input.styles.ts Outdated
Comment on lines +83 to +94
it('renders a custom element via render while keeping the styling contract', () => {
render(
<Input
render={<textarea aria-label='Biography' />}
size='sm'
/>,
);
const input = screen.getByRole('textbox', { name: 'Biography' });
expect(input.tagName).toBe('TEXTAREA');
expect(input).toHaveClass('cl-input');
expect(input).toHaveAttribute('data-size', 'sm');
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Test the callback form of render.

The test only covers a React-element override. Add a case that passes render={props => <input {...props} />}. Verify that the generated class and data-size attributes reach the callback result.

As per coding guidelines, “Unit tests are required for all new functionality.”

🤖 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/input/input.test.tsx` around lines 83 - 94,
Extend the Input tests with a callback-form render case using render={props =>
<input {...props} />}. Locate the resulting input by role and verify the
callback output receives the cl-input class and data-size="sm" attributes,
alongside confirming the custom input renders successfully.

Source: Coding guidelines

Comment thread packages/ui/src/mosaic/components/input/input.styles.ts Outdated

export const styles = stylex.create({
base: {
borderColor: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💭 we maybe need a reset helper that just resets margin, padding, and box-sizing. we can follow up with it.

Comment on lines +64 to +83
borderRadius: radiusVars['--cl-radius-control'],
paddingInline: space['3'],
fontSize: typeScaleVars['--cl-text-xs-size'],
lineHeight: typeScaleVars['--cl-text-xs-leading'],
height: space['7'],
},
md: {
borderRadius: radiusVars['--cl-radius-control'],
paddingInline: space['3'],
fontSize: typeScaleVars['--cl-text-sm-size'],
lineHeight: typeScaleVars['--cl-text-sm-leading'],
height: space['8'],
},
lg: {
borderRadius: radiusVars['--cl-radius-element'],
paddingInline: space['3'],
fontSize: typeScaleVars['--cl-text-base-size'],
lineHeight: 1.375,
height: space['9'],
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what are you thinking for ios zoom when font-size is below 16px?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

':focus-visible': `2px solid ${colorVars['--cl-color-primary']}`,
':focus-visible:where([aria-invalid="true"])': 'none',
},
backgroundColor: colorVars['--cl-color-card'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this be a new token --cl-color-input?

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