Clerk Custom UI
ClerkOfficialCreated by clerk
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides guidance on customizing the authentication experience provided by Clerk. It covers two primary areas: building custom sign-in and sign-up flows using React hooks, and styling pre-built Clerk components to match brand requirements. The skill distinguishes between Core 2 and current SDK versions, ensuring developers apply the correct properties, hooks, and theme imports for their specific environment.
What it does
- Provides instructions for building custom authentication flows with useSignIn and useSignUp hooks.
- Explains how to use the appearance prop to style Clerk components.
- Details how to apply pre-built themes like dark, neobrutalism, and shadcn.
- Guides developers on configuring variables such as colors, typography, and border radius.
- Outlines how to manage component layout options like logos and social button variants.
- Offers specific integration steps for projects using the shadcn/ui design system.
When to use it
- When you need to build a bespoke sign-in or sign-up UI instead of using pre-built components.
- When you need to align Clerk components with your application's branding and design system.
- When you need to implement dark mode or specific visual themes for authentication pages.
- When you are migrating or upgrading between Clerk Core 2 and current SDK versions.
Advantages
- Ensures visual consistency across your application by supporting custom themes and CSS.
- Provides clear version-specific guidance to avoid common API pitfalls.
- Simplifies integration with popular design systems like shadcn/ui.
- Offers granular control over authentication UI components and flow logic.
Usage examples
- “How do I change the primary color of my Clerk sign-in component?”
- The agent will explain how to use the appearance prop with the variables object to set the colorPrimary property.
- “How can I apply the shadcn theme to my Clerk components?”
- The agent will provide the necessary import statements for the shadcn theme and the required CSS import for your global stylesheet.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/clerk/clerk-custom-ui/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip clerk-custom-ui.zip -d .agents/skills
Documentation by clerk
Custom UI
Prerequisite: Ensure
ClerkProviderwraps your app. Seeclerk-setupskill.Version: Check
package.jsonfor the SDK version — seeclerkskill for the version table. This determines which custom flow references to use below.
This skill covers two areas:
Custom authentication flows — build your own sign-in/sign-up UI with hooks
Appearance customization — theme, style, and brand Clerk's pre-built components
What Do You Need?
| Task | Reference |
|---|---|
| Custom sign-in (Core 2 / LTS) | core-2/custom-sign-in.md |
| Custom sign-up (Core 2 / LTS) | core-2/custom-sign-up.md |
| Custom sign-in (Current SDK v7+) | core-3/custom-sign-in.md |
| Custom sign-up (Current SDK v7+) | core-3/custom-sign-up.md |
| Show component pattern (Current SDK) | core-3/show-component.md |
Custom Flow References
| Task | Core 2 | Current |
|---|---|---|
| Custom sign-in (useSignIn) | core-2/custom-sign-in.md | core-3/custom-sign-in.md |
| Custom sign-up (useSignUp) | core-2/custom-sign-up.md | core-3/custom-sign-up.md |
<Show> component | (use <SignedIn>, <SignedOut>, <Protect>) | core-3/show-component.md |
Appearance Customization
Appearance customization applies to both Core 2 and the current SDK.
Component Customization Options
Options: structure, logo, buttons
Themes: prebuilt dark and light themes
Variables: colors, fonts, spacing
Appearance Pattern
<SignIn
appearance={{
variables: {
colorPrimary: '#0000ff',
borderRadius: '0.5rem',
},
options: {
logoImageUrl: '/logo.png',
socialButtonsVariant: 'iconButton',
},
}}
/>Core 2 ONLY (skip if current SDK): The
optionsproperty was namedlayout. Uselayout: { logoImageUrl: '...', socialButtonsVariant: '...' }instead ofoptions.
variables (colors, typography, borders)
| Property | Description |
|---|---|
colorPrimary | Primary color throughout |
colorBackground | Background color |
borderRadius | Border radius (default: 0.375rem) |
Opacity change: colorRing and colorModalBackdrop now render at full opacity. Use explicit rgba() values if you need transparency.
Core 2 ONLY (skip if current SDK):
colorRingandcolorModalBackdroprendered at 15% opacity by default.
options (structure, logo, social buttons)
| Property | Description |
|---|---|
logoImageUrl | URL to custom logo |
socialButtonsVariant | 'blockButton' | 'iconButton' | 'auto' |
socialButtonsPlacement | 'top' | 'bottom' |
showOptionalFields | Show optional fields (default: false) |
Core 2 ONLY (skip if current SDK): This property is called
layout, notoptions. Also,showOptionalFieldsdefaulted totrue.
Themes
Install themes from @clerk/ui:
npm install @clerk/uiimport { dark } from '@clerk/ui/themes'
<ClerkProvider appearance={{ theme: dark }} />Core 2 ONLY (skip if current SDK): Themes are imported from
@clerk/themes(install@clerk/themesinstead of@clerk/ui). Example:import { dark } from '@clerk/themes'.
Theme stacking — pass an array where the last theme takes precedence:
import { dark, neobrutalism } from '@clerk/ui/themes'
<ClerkProvider appearance={{ theme: [dark, neobrutalism] }} />CSS color-scheme support — the default theme respects the CSS color-scheme property for automatic light/dark mode toggling.
Available themes: dark, neobrutalism, shadcn, simple
shadcn Theme
IMPORTANT: If the project has
components.json(shadcn/ui installed), ALWAYS apply the shadcn theme as the FIRST customization step. This ensures Clerk components visually match the existing shadcn design system. Skip this only if the user explicitly requests a different theme.
If the project uses shadcn/ui (check for components.json in the project root), always use the shadcn theme:
import { shadcn } from '@clerk/ui/themes'
<ClerkProvider appearance={{ theme: shadcn }} />Also import shadcn CSS in your global styles:
@import 'tailwindcss';
@import '@clerk/ui/themes/shadcn.css';Core 2 ONLY (skip if current SDK): Import from
@clerk/themesand@clerk/themes/shadcn.css:import { shadcn } from '@clerk/themes'@import '@clerk/themes/shadcn.css';
Workflow
Identify customization needs (custom flow or appearance)
For custom flows: check SDK version → read appropriate
core-2/orcore-3/referenceFor appearance: WebFetch the appropriate documentation above
Apply appearance prop to your Clerk components or build custom flow with hooks
Common Pitfalls
| Issue | Solution |
|---|---|
| Colors not applying | Use colorPrimary not primaryColor |
| Logo not showing | Put logoImageUrl inside options: {} (or layout: {} in Core 2) |
| Social buttons wrong | Add socialButtonsVariant: 'iconButton' in options (or layout in Core 2) |
| Styling not working | Use appearance prop, not direct CSS (unless with bring-your-own-css) |
| Hook returns different shape | Check SDK version — Core 2 and current have completely different useSignIn/useSignUp APIs |
See Also
clerk-setup- Initial Clerk installclerk-nextjs-patterns- Next.js patternsclerk-orgs- B2B organizations
Files
- ATTRIBUTION.mdAdded by AutoGineer839 B
- SKILL.md6.3 KiB
- core-2/custom-sign-in.md5.4 KiB
- core-2/custom-sign-up.md4.6 KiB
- core-3/custom-sign-in.md9.0 KiB
- core-3/custom-sign-up.md7.5 KiB
- core-3/show-component.md4.0 KiB
core-3/custom-sign-up.md
Custom Sign-Up Flow
Build a custom sign-up experience using the useSignUp() hook.
Hook API
import { useSignUp } from '@clerk/nextjs' // or @clerk/react, @clerk/expo
const { signUp, errors, fetchStatus } = useSignUp()| Property | Type | Description |
|---|---|---|
signUp | SignUpFuture | Sign-up object with namespaced methods |
errors | Errors<SignUpFields> | Structured error object |
fetchStatus | 'idle' | 'fetching' | Network request status |
Sign-Up Methods
Password (Email/Password)
const { error } = await signUp.password({
emailAddress: '[email protected]',
password: 'securePassword123',
firstName: 'Jane', // optional
lastName: 'Doe', // optional
})SSO (OAuth)
const { error } = await signUp.sso({
strategy: 'oauth_google', // or 'oauth_github', etc.
redirectUrl: '/dashboard', // where to go after SSO completes
redirectCallbackUrl: '/sso-callback', // intermediate callback route
})Web3
const { error } = await signUp.web3({ strategy: 'web3_solana_signature' })Update (add fields to existing sign-up)
Use update() to add optional fields (name, metadata, legal acceptance, locale) to an existing sign-up before finalization.
const { error } = await signUp.update({
firstName: 'Jane',
lastName: 'Doe',
unsafeMetadata: { referralSource: 'twitter' },
legalAccepted: true,
})Email / Phone Verification
After creating a sign-up, verify the user's email or phone:
Email Code
// Send verification code
const { error } = await signUp.verifications.sendEmailCode()
// Verify the code
const { error } = await signUp.verifications.verifyEmailCode({ code: '123456' })Phone Code
// Send verification code
const { error } = await signUp.verifications.sendPhoneCode()
// Verify the code
const { error } = await signUp.verifications.verifyPhoneCode({ code: '123456' })Email Link
// verificationUrl: where the user lands after clicking the email link (relative or absolute)
const { error } = await signUp.verifications.sendEmailLink({ verificationUrl: '/verify' })
// User clicks the link in their email to verifyFinalizing Sign-Up
After successful sign-up and verification, call finalize() to activate the session:
await signUp.finalize({
navigate: async ({ session, decorateUrl }) => {
const destination = session.currentTask
? `/sign-up/tasks/${session.currentTask.key}`
: '/'
const url = decorateUrl(destination)
// decorateUrl may return an absolute URL for Safari ITP
if (url.startsWith('http')) {
window.location.href = url
} else {
router.push(url)
}
},
})Transferable Sign-Ups
If signUp.isTransferable is true, the identifier matches an existing user and the sign-up should be transferred to a sign-in flow. This involves coordinating between sign-up and sign-in resources. See the transferable sign-up docs for the full implementation.
Reset State
Clear local sign-up state and start over:
signUp.reset()Error Handling
All methods return Promise<{ error: ClerkError | null }>. Errors are also available reactively on the hook:
const { signUp, errors } = useSignUp()
// Field-level errors
errors?.fields?.emailAddress // { code, message, longMessage? }
errors?.fields?.password // { code, message, longMessage? }
errors?.fields?.firstName // { code, message, longMessage? }
errors?.fields?.lastName // { code, message, longMessage? }
errors?.fields?.phoneNumber // { code, message, longMessage? }
errors?.fields?.username // { code, message, longMessage? }
errors?.fields?.code // { code, message, longMessage? }
// Global errors
errors?.global // ClerkGlobalHookError[] | null
// Raw error array
errors?.raw // ClerkError[] | nullComplete Example: Phone OTP Sign-Up
From the docs. Uses phone OTP with inline comments for adapting to email OTP.
'use client'
import * as React from 'react'
import { useAuth, useSignUp } from '@clerk/nextjs'
import { useRouter } from 'next/navigation'
export default function SignUpPage() {
const { signUp, errors, fetchStatus } = useSignUp()
const { isSignedIn } = useAuth()
const router = useRouter()
const handleSubmit = async (formData: FormData) => {
// For email OTP: collect the email address instead of the phone number
const phoneNumber = formData.get('phoneNumber') as string
// For email OTP: change create({ phoneNumber }) to create({ emailAddress })
const error = await signUp.create({ phoneNumber })
// For email OTP: change sendPhoneCode() to sendEmailCode()
if (!error) await signUp.verifications.sendPhoneCode()
}
const handleVerify = async (formData: FormData) => {
const code = formData.get('code') as string
// For email OTP: change verifyPhoneCode() to verifyEmailCode()
await signUp.verifications.verifyPhoneCode({ code })
if (signUp.status === 'complete') {
await signUp.finalize({
navigate: ({ session, decorateUrl }) => {
if (session?.currentTask) {
// Handle pending session tasks
// See https://clerk.com/docs/guides/development/custom-flows/authentication/session-tasks
console.log(session?.currentTask)
return
}
const url = decorateUrl('/')
if (url.startsWith('http')) {
window.location.href = url
} else {
router.push(url)
}
},
})
}
}
if (signUp.status === 'complete' || isSignedIn) {
return null
}
if (
signUp.status === 'missing_requirements' &&
// For email OTP: check for phone_number instead of email_address
signUp.unverifiedFields.includes('phone_number') &&
signUp.missingFields.length === 0
) {
return (
<>
<h1>Verify your account</h1>
<form action={handleVerify}>
<div>
<label htmlFor="code">Code</label>
<input id="code" name="code" type="text" />
</div>
{errors.fields.code && <p>{errors.fields.code.message}</p>}
<button type="submit" disabled={fetchStatus === 'fetching'}>
Verify
</button>
</form>
{/* For email OTP: change sendPhoneCode() to sendEmailCode() */}
<button onClick={() => signUp.verifications.sendPhoneCode()}>I need a new code</button>
</>
)
}
return (
<>
<h1>Sign up</h1>
<form action={handleSubmit}>
{/* For email OTP: collect the emailAddress instead */}
<div>
<label htmlFor="phoneNumber">Phone number</label>
<input id="phoneNumber" name="phoneNumber" type="tel" />
{errors.fields.phoneNumber && <p>{errors.fields.phoneNumber.message}</p>}
</div>
<button type="submit" disabled={fetchStatus === 'fetching'}>
Continue
</button>
</form>
{errors && <p>{JSON.stringify(errors, null, 2)}</p>}
{/* Required for sign-up flows. Clerk's bot sign-up protection is enabled by default */}
<div id="clerk-captcha" />
</>
)
}Docs
Requirements and compatibility
Written for: Claude Code
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Names Claude Code tools, Needs Node.js
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- clerk
- Publisher
- Clerk (Official)
- Source
- clerk/skills · skills/clerk-custom-ui · commit c5d2c0d
- Licence
- MIT License (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by clerk.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download clerk-custom-ui.zip