Skip to content

Toast

<ts-toast> vv0.4.0

The ts-toast component.

Open in Storybook for interactive demos.

<ts-toast duration="5000" position="top-right">Content</ts-toast>
PropertyAttributeTypeDefaultDescription
dismissibledismissiblebooleantrueWhether the toast shows a close button.
durationdurationnumber5000Auto-dismiss duration in ms. Set 0 to disable.
openopenbooleanfalseWhether the toast is visible.
positionposition"bottom-center" | "bottom-left" | "bottom-right" | "top-center" | "top-left" | "top-right"'top-right'Position of the toast on screen.
variantvariant"danger" | "info" | "neutral" | "success" | "warning"'info'The toast’s visual variant.
EventDetailBubblesComposedDescription
tsClosevoidYesYesEmitted when the toast is dismissed.
MethodSignatureDescription
closeclose() => Promise<void>Programmatically close the toast.
showshow() => Promise<void>Programmatically show the toast.
NameDescription
*(default)*Default slot for message content.
actionOptional action button.

Use ::part() to style internal elements:

PartDescription
actionThe action slot wrapper.
baseThe toast container.
closeThe close button.
iconThe variant icon wrapper.
messageThe message wrapper.
ts-toast::part(action) {
/* your custom styles */
}
<ts-toast duration="5000" position="top-right">Content</ts-toast>
import { TsToast } from '@tessera-ui/react';
<TsToast dismissible duration="5000">Content</TsToast>