Theme Toggle
One recipe, two bindings — rendered side by side from the same source the package ships.
React
Toggles
data-theme on the document and persists the choice.import { ThemeToggle } from "../react/index.js";
export default function ThemeToggleDemo() {
return (
<div className="flex items-center gap-3">
<ThemeToggle />
<span className="text-sm text-ink-secondary">
Toggles <code className="font-mono">data-theme</code> on the document
and persists the choice.
</span>
</div>
);
}
Svelte
Toggles
data-theme on the document and persists
the choice.<script lang="ts">
import { ThemeToggle } from "../svelte/index.js";
</script>
<div class="flex items-center gap-3">
<ThemeToggle />
<span class="text-sm text-ink-secondary">
Toggles <code class="font-mono">data-theme</code> on the document and persists
the choice.
</span>
</div>