mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
29 lines
687 B
Svelte
29 lines
687 B
Svelte
<script>
|
|
import { onMount } from "svelte";
|
|
import { Select, SelectItem } from "carbon-components-svelte";
|
|
|
|
let theme = undefined;
|
|
|
|
onMount(() => {
|
|
theme = localStorage.getItem("theme") || "g10";
|
|
});
|
|
|
|
$: if (theme) {
|
|
localStorage.setItem("theme", theme);
|
|
document.documentElement.setAttribute("carbon-theme", theme);
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
:global(.bx--select-input) {
|
|
width: auto;
|
|
min-width: 0;
|
|
}
|
|
</style>
|
|
|
|
<Select inline labelText="Theme" bind:selected={theme}>
|
|
<SelectItem value="white" text="White" />
|
|
<SelectItem value="g10" text="Gray 10" />
|
|
<SelectItem value="g90" text="Gray 90" />
|
|
<SelectItem value="g100" text="Gray 100" />
|
|
</Select>
|