BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/better-auth-ui/theme

Theme

better-auth-ui/theme
FreeComponent

Theme plugin: theme-library agnostic theme selection. Registers an Appearance card in account settings and a theme toggle in the user button. Pass `useTheme` from your theme library (e.g. next-themes) or static `setTheme`.

Live preview

live · rendered by the registry
Rendered by better-auth-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://better-auth-ui.com/r/theme.json

Source

src/components/auth/theme/appearance.tsxbetter-auth-ui.com/r/theme.json
1"use client"
2
3import {
4 ThemePreviewDark,
5 ThemePreviewLight,
6 ThemePreviewSystem,
7 useAuthPlugin
8} from "@better-auth-ui/react"
9import { Monitor, Moon, Sun } from "lucide-react"
10import { useEffect, useState } from "react"
11
12import { Card, CardContent } from "@/components/ui/card"
13import {
14 Field,
15 FieldContent,
16 FieldLabel,
17 FieldTitle
18} from "@/components/ui/field"
19import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
20import { themePlugin } from "@/lib/auth/theme-plugin"
21import { cn } from "@/lib/utils"
22
23export type AppearanceProps = {
24 className?: string
25}
26
27/**
28 * Renders a theme selector card with visual theme previews.
29 *
30 * Displays a card containing radio buttons for selecting between system, light,
31 * and dark themes. Each option shows a visual preview of the theme.
32 *
33 * @param className - Optional additional CSS class names for the card container.
34 * @returns A JSX element containing the theme selector card.
35 */
36export function Appearance({ className }: AppearanceProps) {
37 const { useTheme, localization } = useAuthPlugin(themePlugin)
38 const { theme, setTheme, themes = [] } = useTheme()
39
40 const [isMounted, setIsMounted] = useState(false)
41 useEffect(() => setIsMounted(true), [])
42
43 return (
44 <div>
45 <h2 className="text-sm font-semibold mb-3">{localization.appearance}</h2>
46
47 <Card className={cn(className)}>
48 <CardContent>
49 <Field>
50 <FieldLabel>{localization.theme}</FieldLabel>
51
52 <RadioGroup
53 value={isMounted ? theme : ""}
54 onValueChange={setTheme}
55 className="grid gap-3 grid-cols-2 sm:grid-cols-3"
56 disabled={!isMounted || !theme}
57 >
58 {themes.includes("system") && (
59 <FieldLabel htmlFor="system">
60 <Field orientation="horizontal">
61 <FieldContent className="gap-2">
62 <div className="flex items-center gap-2 justify-between">
63 <FieldTitle>
64 <Monitor className="size-4 text-muted-foreground" />
65
66 {localization.system}
67 </FieldTitle>
68
69 <RadioGroupItem value="system" id="system" />
70 </div>
71
72 <ThemePreviewSystem className="w-full" />
73 </FieldContent>
74 </Field>
75 </FieldLabel>
76 )}
77
78// … truncated

What it pulls in

npm packages

  • @better-auth-ui/react@latest
  • @better-auth-ui/core@latest
  • lucide-react

Other registry items

  • card
  • dropdown-menu
  • field
  • radio-group
  • tabs

Files it writes

  • src/lib/auth/auth-plugin.ts
  • src/lib/auth/theme-plugin.ts
  • src/components/auth/theme/appearance.tsx
  • src/components/auth/theme/theme-toggle-item.tsx

Facts

Registry
better-auth-ui
Type
registry:component
Access
Free
Files written
4
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on better-auth-ui better-auth-ui.com better-auth-ui/better-auth-ui on GitHub Raw registry item This item as JSON

More from better-auth-ui

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Account Settingsaccount-settingsbetter-auth-uiComponentsFree2 deps
Active Sessionsactive-sessionsbetter-auth-uiComponentsFree5 deps · 2 files
Additional Fieldadditional-fieldbetter-auth-uiComponentsFree5 deps
Adminadminbetter-auth-uiComponentsFree4 deps · 3 files
Anonymousanonymousbetter-auth-uiComponentsFree4 deps · 3 files
API Keyapi-keybetter-auth-uiComponentsFree4 deps · 10 files
Authauthbetter-auth-uiComponentsFree2 deps
Auth Providerauth-providerbetter-auth-uiComponentsFree4 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex