Skip to content

Snackbar

The snackbar component.

  • Import
    import "@tapsioss/web-components/snackbar";
  • Tag
    <tapsi-snackbar></tapsi-snackbar>

Properties

NameDescriptionTypeDefault Value
openIndicates whether the snackbar is open or not.booleanfalse
dismissibleIndicates whether the snackbar can be dismissed.booleanfalse
textSets the text of the snackbar.string""
durationThe time before the snackbar automatically closes (in milliseconds).number-1
colorThe color of the snackbar, indicating the type of message. Defaults to inverse."success" | "error" | "info" | "warning" | "inverse""inverse"

Slots

NameDescription
iconThe slot for icon when color is inverse.

TIP

You can use slot names as variables:

ts
import { Slots } from "@tapsioss/web-components/snackbar";

console.log(Slots.ICON); // "icon"

Events

NameDescriptionType
showFires when the snackbar should be visible. (Cancelable)ShowEvent
hideFires when the snackbar should be hidden. (Cancelable)HideEvent

TIP

You can import custom event names:

ts
import { 
  ShowEvent,
  HideEvent
} from "@tapsioss/web-components/snackbar";

element.addEventListener(ShowEvent.type, handleTapsiSnackbarShow);
element.addEventListener(HideEvent.type, handleTapsiSnackbarHide);