Skip to content

Snackbar ​

Basic

Loading...

Snackbars (also known as toasts) are used for brief notifications. They appear temporarily and float above the UI.

  • Tag: <flint-snackbar>
  • Class: FlintSnackbar

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintSnackbar } from '@getufy/flint-ui';

Usage ​

html
<flint-snackbar></flint-snackbar>

Properties ​

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseWhether the snackbar is open.
defaultOpendefault-openbooleanfalseInitial open state for uncontrolled usage.
messagemessagestring''The message to display (slot fallback).
autoHideDurationauto-hide-durationnumber5000Duration in milliseconds before the snackbar auto-closes.
anchorOriginanchor-origin'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right''bottom-center'Position of the snackbar.
pauseOnHoverpause-on-hoverbooleantruePause the auto-hide timer while the user hovers over the snackbar.
closableclosablebooleanfalseShow a dismiss (✕) button.
dismissibledismissibleboolean—Alias for closable. Whether the snackbar can be dismissed.
variantvariant'default' | 'info' | 'success' | 'warning' | 'error''default'Visual style variant.

Events ​

EventDetailDescription
flint-snackbar-open&#123; open: true &#125;Fired when the snackbar opens (bubbles, composed). detail: &#123; open: true &#125;
flint-snackbar-close&#123; open: false &#125;Fired when the snackbar closes (bubbles, composed). detail: &#123; open: false &#125;

Slots ​

NameDescription
actionThe action to display inside the snackbar.
(default)Optional content to display inside the snackbar, such as a message or a flint-alert.

CSS Parts ​

NameDescription
snackbarThe inner snackbar container.

CSS Custom Properties ​

PropertyDefault
--flint-snackbar-min-width—
--flint-snackbar-max-width—
--flint-snackbar-bg—
--flint-snackbar-color—
--flint-snackbar-z-index—
--flint-snackbar-offset—
--flint-snackbar-bg-info—
--flint-snackbar-bg-success—
--flint-snackbar-bg-warning—
--flint-snackbar-bg-error—
--flint-font-family—
--flint-border-radius-md—
--flint-shadow-lg—

Methods ​

MethodDescription
close(): voidCloses the snackbar.