<Button popovertarget="single-line-snackbar">Show Snackbar</Button>
<Snackbar
{icon}
id="single-line-snackbar"
label="Single line snackbar with action and icon"
actionLabel="Action"
/>
Two-line snackbar
Two line snackbar
with action and icon
<Button popovertarget="two-single-line-snackbar">Show Snackbar</Button>
<Snackbar
{icon}
id="two-single-line-snackbar"
label="Two line snackbar"
supportingText="with action and icon"
actionLabel="Action"
/>
Text to display in the action button. If undefined, the action button will not
be shown.
icon
Snippet | undefined
undefined
Icon for the close affordance
timeout
number
3000
Time in milliseconds before the snackbar closes. If set to <= 0, the
snackbar will stay open until another action triggers it.
popover
'auto' | 'manual'
'auto'
Whether the snackbar should be controlled manually or automatically.
onActionClick
(event: Event) => void | undefined
undefined
Function that is triggered when clicking on the action button.
onIconClick
(event: Event) => void
hidePopover()
Function that is triggered when clicking on the icon button.
...attributes
HTMLAttributes<HTMLDivElement>
Attributes are passed to the component container.
Bindables
Attribute
Type
Description
element
HTMLElement
A reference to the root DOM element of the component. This variable is bound using bind:this, allowing direct access to the underlying HTML element for manipulation or querying within
the component's logic.