-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy path_Simple.svelte
More file actions
70 lines (65 loc) · 1.17 KB
/
_Simple.svelte
File metadata and controls
70 lines (65 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<div class="radio-demo">
{#each options as option}
<FormField>
<Radio
bind:group={selected}
value={option.name}
disabled={option.disabled}
/>
{#snippet label()}
{option.name}{option.disabled ? ' (disabled)' : ''}
{/snippet}
</FormField>
{/each}
</div>
<div style="margin-top: 1em;">
<Button
onclick={() => {
selected = 'Doc';
}}
>
Select Doc Programmatically
</Button>
</div>
<pre class="status">Selected: {selected}</pre>
<script lang="ts">
import Radio from '@smui/radio';
import FormField from '@smui/form-field';
import Button from '@smui/button';
let options = [
{
name: 'Bashful',
disabled: false,
},
{
name: 'Doc',
disabled: true,
},
{
name: 'Dopey',
disabled: false,
},
{
name: 'Happy',
disabled: false,
},
{
name: 'Sleepy',
disabled: false,
},
{
name: 'Sneezy',
disabled: false,
},
{
name: 'Grumpy',
disabled: false,
},
];
let selected = $state('Grumpy');
</script>
<style>
.radio-demo > :global(*) {
margin: 0 0.2em;
}
</style>