-
-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy path_StackedWithAction.svelte
More file actions
39 lines (34 loc) · 1.06 KB
/
_StackedWithAction.svelte
File metadata and controls
39 lines (34 loc) · 1.06 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
<Snackbar
variant="stacked"
bind:this={snackbar}
onSMUISnackbarClosed={handleClosedStacked}
>
<Label>
This is a stacked snackbar. Use it when you have really long text.
</Label>
<Actions>
<Button onclick={() => (action = 'Something')}>Something</Button>
<Button onclick={() => (action = 'Another')}>Another</Button>
<IconButton
onclick={() => (action = 'Dismissed')}
class="material-icons"
title="Dismiss">close</IconButton
>
</Actions>
</Snackbar>
<Button onclick={() => snackbar.open()}>
<Label>Open Snackbar</Label>
</Button>
<pre class="status">Closed Reason: {reason}</pre>
<pre class="status">Action: {action}</pre>
<script lang="ts">
import Snackbar, { Actions, Label } from '@smui/snackbar';
import Button from '@smui/button';
import IconButton from '@smui/icon-button';
let snackbar: Snackbar;
let reason = $state('nothing yet');
let action = $state('nothing yet');
function handleClosedStacked(e: CustomEvent<{ reason: string | undefined }>) {
reason = e.detail.reason ?? 'Undefined.';
}
</script>