@hanzo/ui

Toast

import { ToastProvider, useToast } from '@hanzo/ui/product'

No examples yet.

Types

export type ToastKind = 'success' | 'error' | 'warning' | 'info'
export type ToastInput = {
  title: string
  description?: string
  kind?: ToastKind
  /** Auto-dismiss after this many ms; 0 keeps it until dismissed. */
  durationMs?: number
  /** Drop the leading icon. Defaults to showing it. */
  showIcon?: boolean
}
export type Toast = ToastInput & {
  id: number
  kind: ToastKind
  durationMs: number
  showIcon: boolean
}
export type ToastApi = {
  toast: (t: ToastInput) => void
  success: (title: string, description?: string) => void
  error: (title: string, description?: string) => void
  warning: (title: string, description?: string) => void
  info: (title: string, description?: string) => void
  dismiss: (id: number) => void
}

Exports

ToastProvideruseToasttype ToastKindtype ToastInputtype Toasttype ToastApi