Skip to content

Toast

Toast is a notification component used to display a short and temporary message to the user. The message appears in the top of the screen and disappears after a few seconds or can be closed by the user manually.

Toast

Used to show dynamic notifications and alerts to user.

Import

js
import { MpToastManager, toast } from '@mekari/pixel3'

Playground

API

tsx
// Render MpToastManager in the root of app
<MpToastManager />

// Use toast.notify to show toast, and pass an options object
toast.notify({ title: 'Setting is imported.' })

// Use toast.clearAll to dismiss all toasts
toast.clearAll()

toast

Props
NameTypeDefault
id
Id of toast.
string -
title
Title of toast.
string -
variant
Variant of toast.
success | errorsuccess
duration
Duration of toast.
number3000
position
Position of toast.
top-left | top-center | top-right | bottom-left | bottom-center | bottom-righttop-center
render
Render VNode to custom content instead of title prop.
any -

Usage

Variant