ThemeSwitch
Light and dark toggle, persisted.
beta
Try it
<ThemeSwitch />Examples
Toggle theme
<script lang="ts">
import ThemeSwitch from '@tcpsystems/ui/foundation/ThemeSwitch';
</script>
<ThemeSwitch />Custom storage key
Studio appearance
<script lang="ts">
import ThemeSwitch from '@tcpsystems/ui/foundation/ThemeSwitch';
import Cluster from '@tcpsystems/ui/foundation/Cluster';
</script>
<Cluster>
<span>Studio appearance</span>
<ThemeSwitch storageKey="studio-theme" />
</Cluster>API
import ThemeSwitch from '@tcpsystems/ui/foundation/ThemeSwitch';| Prop | Type | Default |
|---|---|---|
storageKey? | string | 'tcp-theme' |
| Hook | Kind |
|---|---|
.tcp-theme-switch | Root class |
data-storage-key | Data attribute |
data-variant | Data attribute |