Toast

Display an important message globally.

Standard

Basic usage.

Multiline

Display multiline or overlong text.

Action

Add a custom button to the Toast.

Cancel

Use passive to change the style of the button.

Type

APIs / Schnittstellendokumentation

useToasts

const [toasts: Array<Toast>, setToast: (toast: Toast) => void] = useToasts()

Toast

interface Toast {
  text?: string
  type?: NormalTypes
  delay?: number
  actions?: Array<ToastAction>
}

ToastAction

interface ToastAction {
  name: string
  handler: (event: React.MouseEventHandler<HTMLButtonElement>, cancel: () => void) => void
  passive?: boolean
}

NormalTypes

type NormalTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'

Co-Creators