Switches between light and dark. The sun folds into the moon as the theme spreads.
FreeWeb and Mobile2 variantsMotion
Preview
npx shadcn add @fetaui/theme-switchPlayground
Appearance card
AppearanceSwitching
Theme
Dark spreads from the button
Icon
Label
Disabled
Style
Icons animation
Motion
Installation
Terminal· bash
npx shadcn add @fetaui/theme-switch
Accessibility
- The label names the theme it will switch to.
- The icon is decorative.
Motion
- The icon rotates 90 degrees with the out easing.
- The new theme spreads from the button with a view transition.
- With reduced motion, the theme changes at once.
Responsive behavior
- 36 px on Web, and 44 px on Mobile.
Performance
- The view transition runs only where the browser supports it, and never when still.
Note for AI
Give your coding assistant the Markdown reference instead of screenshots.
- Import
ThemeSwitchfrom@/components/fetaui/theme-switch.kindisiconorlabel. - It does not change your theme by itself. Apply the theme in
onValueChange, which runs inside the view transition. - The demo changes only its own label and icon.
- Pass the saved theme as
valueordefaultValue. It composesButton,IconButtonand the spread from Theme Toggle.