-
Notifications
You must be signed in to change notification settings - Fork 366
feat(themes): Add shadcn theme #6322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(themes): Add shadcn theme #6322
Conversation
🦋 Changeset detectedLatest commit: 72eea01 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
!snapshot |
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.1.9-snapshot.v20250716141613 --save-exact
npm i @clerk/astro@2.10.6-snapshot.v20250716141613 --save-exact
npm i @clerk/backend@2.4.4-snapshot.v20250716141613 --save-exact
npm i @clerk/chrome-extension@2.5.7-snapshot.v20250716141613 --save-exact
npm i @clerk/clerk-js@5.73.1-snapshot.v20250716141613 --save-exact
npm i @clerk/elements@0.23.41-snapshot.v20250716141613 --save-exact
npm i @clerk/clerk-expo@2.14.6-snapshot.v20250716141613 --save-exact
npm i @clerk/expo-passkeys@0.3.18-snapshot.v20250716141613 --save-exact
npm i @clerk/express@1.7.8-snapshot.v20250716141613 --save-exact
npm i @clerk/fastify@2.4.8-snapshot.v20250716141613 --save-exact
npm i @clerk/localizations@3.19.1-snapshot.v20250716141613 --save-exact
npm i @clerk/nextjs@6.25.2-snapshot.v20250716141613 --save-exact
npm i @clerk/nuxt@1.7.9-snapshot.v20250716141613 --save-exact
npm i @clerk/clerk-react@5.35.1-snapshot.v20250716141613 --save-exact
npm i @clerk/react-router@1.8.2-snapshot.v20250716141613 --save-exact
npm i @clerk/remix@4.10.2-snapshot.v20250716141613 --save-exact
npm i @clerk/shared@3.12.2-snapshot.v20250716141613 --save-exact
npm i @clerk/tanstack-react-start@0.20.2-snapshot.v20250716141613 --save-exact
npm i @clerk/testing@1.10.2-snapshot.v20250716141613 --save-exact
npm i @clerk/themes@2.4.0-snapshot.v20250716141613 --save-exact
npm i @clerk/types@4.66.1-snapshot.v20250716141613 --save-exact
npm i @clerk/vue@1.8.16-snapshot.v20250716141613 --save-exact |
!snapshot |
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.1.11-snapshot.v20250716183151 --save-exact
npm i @clerk/astro@2.10.8-snapshot.v20250716183151 --save-exact
npm i @clerk/backend@2.5.0-snapshot.v20250716183151 --save-exact
npm i @clerk/chrome-extension@2.5.9-snapshot.v20250716183151 --save-exact
npm i @clerk/clerk-js@5.73.3-snapshot.v20250716183151 --save-exact
npm i @clerk/elements@0.23.43-snapshot.v20250716183151 --save-exact
npm i @clerk/clerk-expo@2.14.8-snapshot.v20250716183151 --save-exact
npm i @clerk/expo-passkeys@0.3.20-snapshot.v20250716183151 --save-exact
npm i @clerk/express@1.7.10-snapshot.v20250716183151 --save-exact
npm i @clerk/fastify@2.4.10-snapshot.v20250716183151 --save-exact
npm i @clerk/localizations@3.19.3-snapshot.v20250716183151 --save-exact
npm i @clerk/nextjs@6.25.4-snapshot.v20250716183151 --save-exact
npm i @clerk/nuxt@1.7.11-snapshot.v20250716183151 --save-exact
npm i @clerk/clerk-react@5.35.3-snapshot.v20250716183151 --save-exact
npm i @clerk/react-router@1.8.4-snapshot.v20250716183151 --save-exact
npm i @clerk/remix@4.10.4-snapshot.v20250716183151 --save-exact
npm i @clerk/shared@3.12.4-snapshot.v20250716183151 --save-exact
npm i @clerk/tanstack-react-start@0.20.4-snapshot.v20250716183151 --save-exact
npm i @clerk/testing@1.10.4-snapshot.v20250716183151 --save-exact
npm i @clerk/themes@2.4.0-snapshot.v20250716183151 --save-exact
npm i @clerk/types@4.67.1-snapshot.v20250716183151 --save-exact
npm i @clerk/vue@1.8.18-snapshot.v20250716183151 --save-exact |
@@ -279,14 +279,13 @@ const NavButton = (props: NavButtonProps) => { | |||
gap: t.space.$3, | |||
justifyContent: 'flex-start', | |||
backgroundColor: isActive ? t.colors.$neutralAlpha100 : undefined, | |||
color: isActive ? t.colors.$primary500 : t.colors.$neutralAlpha600, | |||
color: isActive ? t.colors.$primary500 : t.colors.$colorMutedForeground, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 WalkthroughWalkthroughA new theme named "shadcn" was introduced and exported from the 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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). (23)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
!snapshot |
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.1.11-snapshot.v20250717132356 --save-exact
npm i @clerk/astro@2.10.8-snapshot.v20250717132356 --save-exact
npm i @clerk/backend@2.5.0-snapshot.v20250717132356 --save-exact
npm i @clerk/chrome-extension@2.5.9-snapshot.v20250717132356 --save-exact
npm i @clerk/clerk-js@5.73.3-snapshot.v20250717132356 --save-exact
npm i @clerk/elements@0.23.43-snapshot.v20250717132356 --save-exact
npm i @clerk/clerk-expo@2.14.8-snapshot.v20250717132356 --save-exact
npm i @clerk/expo-passkeys@0.3.20-snapshot.v20250717132356 --save-exact
npm i @clerk/express@1.7.10-snapshot.v20250717132356 --save-exact
npm i @clerk/fastify@2.4.10-snapshot.v20250717132356 --save-exact
npm i @clerk/localizations@3.20.0-snapshot.v20250717132356 --save-exact
npm i @clerk/nextjs@6.25.4-snapshot.v20250717132356 --save-exact
npm i @clerk/nuxt@1.7.11-snapshot.v20250717132356 --save-exact
npm i @clerk/clerk-react@5.35.3-snapshot.v20250717132356 --save-exact
npm i @clerk/react-router@1.8.4-snapshot.v20250717132356 --save-exact
npm i @clerk/remix@4.10.4-snapshot.v20250717132356 --save-exact
npm i @clerk/shared@3.12.4-snapshot.v20250717132356 --save-exact
npm i @clerk/tanstack-react-start@0.20.4-snapshot.v20250717132356 --save-exact
npm i @clerk/testing@1.10.4-snapshot.v20250717132356 --save-exact
npm i @clerk/themes@2.4.0-snapshot.v20250717132356 --save-exact
npm i @clerk/types@4.68.0-snapshot.v20250717132356 --save-exact
npm i @clerk/vue@1.8.18-snapshot.v20250717132356 --save-exact |
There was a problem hiding this comment.
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 (2)
packages/clerk-js/src/utils/appearance.ts (2)
16-20
: Minor optimization opportunity in array processing.The current implementation uses
forEach
to find the firstcssLayerName
, but this could be more efficient usingfind()
:- appearance.baseTheme.forEach((theme: BaseTheme) => { - if (!cssLayerNameFromBaseTheme && theme.cssLayerName) { - cssLayerNameFromBaseTheme = theme.cssLayerName; - } - }); + const themeWithCssLayerName = appearance.baseTheme.find((theme: BaseTheme) => theme.cssLayerName); + cssLayerNameFromBaseTheme = themeWithCssLayerName?.cssLayerName;This approach is more idiomatic and stops at the first match instead of continuing through the entire array.
44-48
: Redundant variable assignment in single theme handling.The variable
cssLayerNameFromSingleTheme
is unnecessary since we can directly usesingleTheme.cssLayerName
:- let cssLayerNameFromSingleTheme: string | undefined; - - if (singleTheme.cssLayerName) { - cssLayerNameFromSingleTheme = singleTheme.cssLayerName; - } + const cssLayerNameFromSingleTheme = singleTheme.cssLayerName;This simplification reduces code complexity while maintaining the same functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/clerk-js/src/core/clerk.ts
(2 hunks)packages/clerk-js/src/utils/__tests__/appearance.spec.ts
(1 hunks)packages/clerk-js/src/utils/appearance.ts
(1 hunks)packages/clerk-js/src/utils/index.ts
(1 hunks)packages/themes/src/createTheme.ts
(1 hunks)packages/themes/src/themes/shadcn.ts
(1 hunks)packages/types/src/appearance.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/clerk-js/src/utils/index.ts
- packages/themes/src/createTheme.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/themes/src/themes/shadcn.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*
Instructions used from:
Sources:
⚙️ CodeRabbit Configuration File
🧬 Code Graph Analysis (3)
packages/clerk-js/src/utils/__tests__/appearance.spec.ts (2)
packages/types/src/appearance.ts (2)
Appearance
(969-1031)BaseTheme
(809-809)packages/clerk-js/src/utils/appearance.ts (1)
processCssLayerNameExtraction
(7-67)
packages/clerk-js/src/utils/appearance.ts (1)
packages/types/src/appearance.ts (2)
Appearance
(969-1031)BaseTheme
(809-809)
packages/clerk-js/src/core/clerk.ts (1)
packages/clerk-js/src/utils/appearance.ts (1)
processCssLayerNameExtraction
(7-67)
⏰ 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). (5)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Build Packages
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (10)
packages/types/src/appearance.ts (1)
809-809
: LGTM! Clean type extension for CSS layer support.The intersection type correctly extends
BaseTheme
to include the optionalcssLayerName
property, enabling the new CSS layer functionality while maintaining backward compatibility.packages/clerk-js/src/core/clerk.ts (1)
115-115
: LGTM: Import statement is correctThe import of
processCssLayerNameExtraction
is properly added and follows the existing import pattern.packages/clerk-js/src/utils/__tests__/appearance.spec.ts (8)
1-5
: LGTM: Test file setup is correctThe imports and test setup are properly structured.
7-23
: LGTM: Comprehensive test for single baseTheme extractionThe test properly validates that
cssLayerName
is extracted from a single baseTheme and moved to the appearance level while preserving other properties.
25-40
: LGTM: Precedence test validates correct behaviorThe test correctly verifies that appearance-level
cssLayerName
takes precedence over baseTheme-level values, which is the expected behavior.
42-72
: LGTM: Array baseTheme test is comprehensiveThe test properly validates the array handling logic, including extraction of the first
cssLayerName
found and removal from all array items.
74-97
: LGTM: Array precedence test validates expected behaviorThe test correctly verifies that appearance-level
cssLayerName
takes precedence even when multiple baseThemes havecssLayerName
properties.
99-137
: LGTM: Edge cases are properly testedThe tests correctly validate scenarios where no
cssLayerName
is present in baseThemes, ensuring the function handles these cases gracefully.
139-148
: LGTM: No baseTheme test validates edge caseThe test correctly verifies that the function handles the case where no baseTheme is provided while preserving existing appearance properties.
150-173
: LGTM: Final tests complete comprehensive coverageThe tests for undefined input and property preservation ensure the function is robust and doesn't interfere with other appearance properties.
This reverts commit 80671d6.
!snapshot |
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.1.11-snapshot.v20250718154534 --save-exact
npm i @clerk/astro@2.10.8-snapshot.v20250718154534 --save-exact
npm i @clerk/backend@2.5.0-snapshot.v20250718154534 --save-exact
npm i @clerk/chrome-extension@2.5.9-snapshot.v20250718154534 --save-exact
npm i @clerk/clerk-js@5.73.3-snapshot.v20250718154534 --save-exact
npm i @clerk/elements@0.23.43-snapshot.v20250718154534 --save-exact
npm i @clerk/clerk-expo@2.14.8-snapshot.v20250718154534 --save-exact
npm i @clerk/expo-passkeys@0.3.20-snapshot.v20250718154534 --save-exact
npm i @clerk/express@1.7.10-snapshot.v20250718154534 --save-exact
npm i @clerk/fastify@2.4.10-snapshot.v20250718154534 --save-exact
npm i @clerk/localizations@3.20.0-snapshot.v20250718154534 --save-exact
npm i @clerk/nextjs@6.25.4-snapshot.v20250718154534 --save-exact
npm i @clerk/nuxt@1.7.11-snapshot.v20250718154534 --save-exact
npm i @clerk/clerk-react@5.35.3-snapshot.v20250718154534 --save-exact
npm i @clerk/react-router@1.8.4-snapshot.v20250718154534 --save-exact
npm i @clerk/remix@4.10.4-snapshot.v20250718154534 --save-exact
npm i @clerk/shared@3.12.4-snapshot.v20250718154534 --save-exact
npm i @clerk/tanstack-react-start@0.20.4-snapshot.v20250718154534 --save-exact
npm i @clerk/testing@1.10.4-snapshot.v20250718154534 --save-exact
npm i @clerk/themes@2.4.0-snapshot.v20250718154534 --save-exact
npm i @clerk/types@4.68.0-snapshot.v20250718154534 --save-exact
npm i @clerk/vue@1.8.18-snapshot.v20250718154534 --save-exact |
|
||
import { processCssLayerNameExtraction } from '../appearance'; | ||
|
||
describe('processCssLayerNameExtraction', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Awesome that you pulled this out and made it testable.
Description
To support this theme, we've added the ability to specify a
cssLayerName
within a theme - #6344Resolves USER-2373
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Tests
Documentation