Theme Selector
Choose light, dark, or the system appearance.
Preview
Examples
Theme transition
A slide transition declared on this control. Duration is 500 milliseconds. Other controls keep their own settings.
Shadow borders
Use a prominent ambient shadow and inset edge in place of a solid border.
Icon with text
Show an icon beside the theme label.
When to use
-
Let people choose light, dark, or system appearance in app settings.
-
Show the appearance options configured on the provider in one labeled control.
-
Use the floating menu in headers, toolbars, and compact layouts.
When not to use
- A toolbar needs only a quick light/dark action. Use Theme Toggle.
- The choice changes brand colors rather than appearance. Use Color Theme Selector.
Installation
Set up uitheme-web in an existing Tailwind app. Then install the component.
To install with shadcn, first add the UI-Theme registry
to components.json. The style in components.json selects Radix or Base UI.
Usage
Use the component inside your theme provider. Use import paths that match your app’s component directory.
For inline choices, install Theme Disclosure. The floating selector does not install disclosure code.
API reference
These props belong to the installed local control. Configure theme options on the provider.
| Prop | Type | Behavior |
|---|---|---|
label | string | Override the readable accessible label. |
borderStyle | 'solid' | 'shadow' | Use the default solid border or prominent shadow borders. Both use the same space and theme tokens. |
className | string | Extend the root styles. Your classes replace default classes through the local merge helper. |
classes | object | Style root, trigger, content, item, and label parts. |
disabled | boolean | Disable interaction. Preference controls also wait for the provider to mount. |
animationType | ThemeAnimationType | Override the UI theme transition for this control. Defaults to the provider setting. |
duration | number | UI theme transition duration in milliseconds. Defaults to the provider setting. |
slideDirection | SlideDirection | Valid only with animationType set to ThemeAnimationType.SLIDE. Other animation types do not accept this prop. |
display | 'text' | 'icon-text' | Use text by default, or an icon with text. For an icon-only action, use Icon Theme Toggle. Light uses a sun, dark uses a moon, and system uses a monitor. |
Keyboard
| Key | Action |
|---|---|
Enter / Space | Open the selector or confirm the focused option. |
Arrow keys | Move between available appearance options. |
Escape | Close the menu and return focus to the trigger. |
Accessibility
- Keep the label connected to the trigger. Preserve the primitive’s focus behavior.
- The option list comes from the provider. Avoid showing a system option when that option is not configured.
Theme behavior
- Use
themefor the selected preference.Systemstays selected when the operating system changes appearance. - Changes use
switchTheme. The trigger sets the transition origin. The color palette does not change.
AI Agent notes
Use this checklist when a coding agent adds the control.
- Use
uitheme-web/reactfor the runtime. Import the control from its installed local file. The runtime does not export styled controls. - For Next.js, use
NextUIThemeProviderfromuitheme-web/next. For TanStack Start, follow the server bootstrap guide. Create server state for each request.
- Before installation, select the framework, primitive base, Tailwind major version, and language. Run the CLI inside the app or pass
--cwd. - Preview changes with
--dry-run. Keep edited local files. Review the differences before using--overwrite. - Read the provider’s
themesarray. Show only the options configured on the provider. - Use
themefor the selected value. UseresolvedThemefor visual appearance. - Check keyboard controls in the running app. Check that appearance and palette choices survive a reload. Check reduced motion.
Source
The CLI reuses your shared cn utility. If it is missing, installation creates it
at the configured utils path. Existing utilities are checked before a replacement
is offered.
These are the files the CLI installs. The component source stays in your app.
Dependencies: radix-ui, lucide-react
Customization
Use borderStyle="shadow" in React or border-style="shadow" in Vue for prominent shadow borders. The default is solid.
Use slideDirection only when animationType is ThemeAnimationType.SLIDE. Set both props on the control when you need a slide direction override.
Use display="icon-text" to show an icon beside the text. The default is display="text".
For an icon-only action, use Icon Theme Toggle.
Pass animationType, duration, and slideDirection to this control to set its UI theme transition.
These props override the provider settings for this action only.
Keyboard focus shows the theme’s focus ring.
Edit the installed source. Use className in React or class in Vue to style
the root. Use the classes prop to style individual parts. Use label props to change the
visible text.

