Skip to content

Conversation

@alexcarpenter
Copy link
Member

@alexcarpenter alexcarpenter commented Jan 8, 2026

Docs: clerk/clerk-docs#2937

Description

This PR introduces a new lightDark theme that automatically adapts to user's system color scheme preference using the light-dark() CSS function, and improves provider icon customization by supporting CSS variable-based fills.

Usage:

import { lightDark } from '@clerk/ui/themes';
import { ClerkProvider } from '@clerk/nextjs';

export default function MyApp({ Component, pageProps }: AppProps) {
  return (
    <ClerkProvider appearance={{ theme: lightDark }}>
      <Component {...pageProps} />
    </ClerkProvider>
  );
}

CSS Setup:

:root {
  color-scheme: light dark;
}

Browser Support: Requires modern browser support (Chrome 123+, Firefox 120+, Safari 17.4+). For older browsers, users can continue using the dark theme with manual switching.

Provider Icon Customization Improvements

Changes provider icon rendering from <Image> to <Span> elements to enable customizable icon fills via CSS variables.

  • Provider icons for Apple, GitHub, OKX Wallet, and Vercel now use CSS mask-image technique
  • These icons support a customizable --cl-icon-fill CSS variable
  • Other provider icons (like Google) continue to render as full-color images using background-image

Customization Example:

<ClerkProvider
  appearance={{
    elements: {
      providerIcon__apple: {
        '--cl-icon-fill': '#000000', // Custom fill color
      },
      providerIcon__github: {
        '--cl-icon-fill': 'light-dark(#000000, #ffffff)', // Theme-aware fill
      },
    }
  }}
/>

Checklist

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

Type of change

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

Summary by CodeRabbit

  • New Features

    • Added a lightDark theme that adapts to the system color scheme
    • Provider icons now support customizable monochrome fills via CSS variables; select providers preserve full-color rendering
    • Improved provider icon accessibility for assistive technologies
  • Bug Fixes

    • Removed dark-mode icon inversion for several provider icons
  • Chores

    • Made the lightDark theme publicly available

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2026

🦋 Changeset detected

Latest commit: 0501847

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

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Major
@clerk/chrome-extension Patch

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
Copy link

vercel bot commented Jan 8, 2026

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

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 8, 2026 3:48pm

@github-actions github-actions bot added the core-3 label Jan 8, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 8, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7560

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7560

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 0501847

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

This PR updates the clerk UI package: provider icon rendering in SocialButtons.tsx was changed from Image to Span and accessibility labels were added; Apple, GitHub, OKX Wallet, and Vercel icons now use CSS mask-image with a configurable --cl-icon-fill while Google remains a full-color background-image. A new lightDark theme (exported from themes) was introduced using the CSS light-dark() function. Dark and shadcn themes had per-provider icon invert entries removed. Changesets record version and behavioral notes.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately summarizes the primary feature: adding a new lightDark theme that uses CSS light-dark() for automatic system color scheme adaptation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/ui/src/themes/lightDark.ts (1)

3-22: Add JSDoc documentation for the public theme export.

This is a public API that should be documented with JSDoc comments describing its purpose, usage, and requirements (e.g., CSS color-scheme setup). This will improve developer experience and align with the coding guidelines requirement for comprehensive public API documentation.

📝 Example JSDoc documentation
+/**
+ * A theme that automatically adapts to the user's system color scheme preference
+ * using the CSS light-dark() function.
+ * 
+ * Requires CSS color-scheme configuration:
+ * ```css
+ * :root {
+ *   color-scheme: light dark;
+ * }
+ * ```
+ * 
+ * @example
+ * ```tsx
+ * import { lightDark } from '@clerk/ui/themes';
+ * import { ClerkProvider } from '@clerk/nextjs';
+ * 
+ * <ClerkProvider appearance={{ theme: lightDark }}>
+ *   {children}
+ * </ClerkProvider>
+ * ```
+ * 
+ * @remarks
+ * Requires modern browser support (Chrome 123+, Firefox 120+, Safari 17.4+).
+ * For older browsers, consider using the dark theme with manual switching.
+ */
 export const lightDark = createTheme({
packages/ui/src/elements/SocialButtons.tsx (1)

33-33: Consider using const assertion for type safety.

The SUPPORTS_MASK_IMAGE array could benefit from a const assertion to make it readonly and provide better type inference.

🔧 Suggested improvement
-const SUPPORTS_MASK_IMAGE = ['apple', 'github', 'okx_wallet', 'vercel'];
+const SUPPORTS_MASK_IMAGE = ['apple', 'github', 'okx_wallet', 'vercel'] as const;
📜 Review details

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

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b4e2906 and ac9e12a.

📒 Files selected for processing (5)
  • .changeset/seven-grapes-lay.md
  • .changeset/slimy-vans-listen.md
  • packages/ui/src/elements/SocialButtons.tsx
  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/index.ts

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

Avoid barrel files (index.ts re-exports) as they can cause circular dependencies

Files:

  • packages/ui/src/themes/index.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use ESLint with custom configurations tailored for different package types

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use Prettier for code formatting across all packages

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • packages/ui/src/themes/index.ts
  • packages/ui/src/themes/lightDark.ts
  • packages/ui/src/elements/SocialButtons.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components

**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components

Files:

  • packages/ui/src/elements/SocialButtons.tsx
**/*.{md,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Update documentation for API changes

Files:

  • packages/ui/src/elements/SocialButtons.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g., UserProfile, NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...

Files:

  • packages/ui/src/elements/SocialButtons.tsx
🧬 Code graph analysis (1)
packages/ui/src/elements/SocialButtons.tsx (1)
packages/ui/src/customizables/elementDescriptors.ts (1)
  • descriptors (591-591)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
packages/ui/src/elements/SocialButtons.tsx (1)

193-222: [Your rewritten review comment text here]
[Exactly ONE classification tag]

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/tangy-melons-rescue.md (1)

5-5: Expand the changeset description to document feature additions alongside removals.

The changelog entry documents the removal of provider icon filter inversions but omits the new lightDark theme and supporting CSS mask-image approach with --cl-icon-fill variable support. Users consulting the changelog will get an incomplete picture of what changed in this version.

Suggest updating the description to cover both the removals and the new features.

📝 Suggested expanded description
-Removes provider icon filter invert from elements for both `dark` and `shadcn` themes.
+Removes provider icon filter invert from elements for both `dark` and `shadcn` themes.
+
+Adds new `lightDark` theme that adapts automatically to the user's system color scheme using the CSS `light-dark()` function. Enables CSS mask-image based rendering for select provider icons (Apple, GitHub, OKX Wallet, Vercel) with configurable `--cl-icon-fill` variable for theme-aware fills.
📜 Review details

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

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ac9e12a and ccd9a6c.

📒 Files selected for processing (3)
  • .changeset/tangy-melons-rescue.md
  • packages/ui/src/themes/dark.ts
  • packages/ui/src/themes/shadcn.ts
💤 Files with no reviewable changes (2)
  • packages/ui/src/themes/shadcn.ts
  • packages/ui/src/themes/dark.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
.changeset/tangy-melons-rescue.md (1)

2-2: Verify that the release type aligns with the scope of changes in this PR.

The PR adds a new lightDark theme and changes icon rendering behavior (CSS mask-image approach), which are feature additions. The changeset marks this as a patch, but feature additions typically warrant a minor version bump. Verify the intended versioning strategy and confirm whether other changeset files document a major or minor version change for the new theme.

@alexcarpenter
Copy link
Member Author

!allow-major

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