mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
docs(select): add reactive example (#1011)
This commit is contained in:
parent
653a601f9b
commit
e5f77aa614
2 changed files with 25 additions and 0 deletions
|
@ -17,6 +17,10 @@ components: ["Select", "SelectItem", "SelectItemGroup", "SelectSkeleton"]
|
||||||
<SelectItem value="g100" text="Gray 100" />
|
<SelectItem value="g100" text="Gray 100" />
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
|
### Reactive example
|
||||||
|
|
||||||
|
<FileSource src="/framed/Select/SelectReactive" />
|
||||||
|
|
||||||
### Helper text
|
### Helper text
|
||||||
|
|
||||||
<Select helperText="Carbon offers 4 themes (2 light, 3 dark)" labelText="Carbon theme" selected="g10" >
|
<Select helperText="Carbon offers 4 themes (2 light, 3 dark)" labelText="Carbon theme" selected="g10" >
|
||||||
|
|
21
docs/src/pages/framed/Select/SelectReactive.svelte
Normal file
21
docs/src/pages/framed/Select/SelectReactive.svelte
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<script>
|
||||||
|
import { Select, SelectItem, Button } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
let selected = "g10";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Select labelText="Carbon theme" bind:selected>
|
||||||
|
<SelectItem value="white" text="White" />
|
||||||
|
<SelectItem value="g10" text="Gray 10" />
|
||||||
|
<SelectItem value="g80" text="Gray 80" />
|
||||||
|
<SelectItem value="g90" text="Gray 90" />
|
||||||
|
<SelectItem value="g100" text="Gray 100" />
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<div style="margin: var(--cds-layout-01) 0">
|
||||||
|
Selected: <strong>{selected}</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button disabled="{selected === 'g90'}" on:click="{() => (selected = 'g90')}">
|
||||||
|
Set to "g90"
|
||||||
|
</Button>
|
Loading…
Add table
Add a link
Reference in a new issue