-
-
Notifications
You must be signed in to change notification settings - Fork 279
Expand file tree
/
Copy path_List.svelte
More file actions
39 lines (35 loc) · 980 Bytes
/
_List.svelte
File metadata and controls
39 lines (35 loc) · 980 Bytes
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
<Dialog
bind:open
selection
aria-labelledby="list-title"
aria-describedby="list-content"
>
<Title id="list-title">Dialog Title</Title>
<Content id="list-content">
<List>
{#each [...Array(100)].map((_v, i) => i + 1) as item}
<Item
onclick={() => {
clicked = item;
open = false;
}}
>
<Text>Item #{item}</Text>
</Item>
{/each}
</List>
</Content>
</Dialog>
<Button onclick={() => (open = true)}><Label>Open Dialog</Label></Button>
<pre class="status">Clicked: {clicked}{clicked === 69
? ', nice'
: clicked === 42
? ', the answer to life, the universe, and everything'
: ''}</pre>
<script lang="ts">
import Dialog, { Title, Content } from '@smui/dialog';
import Button, { Label } from '@smui/button';
import List, { Item, Text } from '@smui/list';
let open = $state(false);
let clicked: string | number = $state('Nothing yet.');
</script>