Skip to content
tcpsystemsui

Theme

Colour scheme
Accent
Density
Radius
Esc

ThemeSwitch

Light and dark toggle, persisted.

beta

Try it

Svelte
<ThemeSwitch />

Examples

Toggle theme

Toggle theme.svelte
<script lang="ts">
	import ThemeSwitch from '@tcpsystems/ui/foundation/ThemeSwitch';
</script>

<ThemeSwitch />

Custom storage key

Studio appearance
Custom storage key.svelte
<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
import ThemeSwitch from '@tcpsystems/ui/foundation/ThemeSwitch';
PropTypeDefault
storageKey?string'tcp-theme'
HookKind
.tcp-theme-switchRoot class
data-storage-keyData attribute
data-variantData attribute