runway

Runway

Theme Switcher

A Switch component for toggling between light, dark and system themes



The ThemeSwitcher component allows users to toggle between light, dark, and system themes. It's built using the Switcher component with next-themes for theme management.

Since it uses the Switcher you can customize the color, size, and all the other props.



Usage

Since Runway already has next-themes set up in combination with Tailwind, using the ThemeSwitcher is super easy:

javascript

1import ThemeSwitcher from "@/components/molecules/ThemeSwitcher";
2
3<ThemeSwitcher />

Throughout your app, use dark: to apply styles in dark mode. i.e. bg-white dark:bg-black




Props

The TextLink component accepts the following props:

NameTypeDefaultDescription
colorstringgrayThe color of the Switcher (see tailwind.config).
variant"soft" | "solid"softThe variant of the Switcher.
size"xs" |"sm" | "md" | "lg"smThe size of the Switcher.
borderRadiusstring"full"Tailwind border-radius class (e.g. "none", "xs", "sm", "md", "lg", "full", etc.).
buttonBorderbooleantrueIf true, the Switcher will have a border around selected button.
borderbooleanfalseIf true, the Switcher will have a border.
verticalbooleanfalseIf true, the Switcher will be displayed vertically.
systembooleantrueIf true, the Switcher will include a system theme option.
classNamestring""Additional Tailwind classes for the Switcher.

The ThemeSwitcher component uses the Switcher component.




Examples

Default Theme Switcher

Just drop it in your app and you're good to go!


Custom Theme Switcher

You can customize the color, size, and all the other props.


Custom Theme Switcher with No System Option