Argent

Toast

A brief message that does not interrupt.

    import { Button, ToastProvider, useToast } from '@rajatweb/argent'
    
    function Save() {
      const toast = useToast()
      return <Button onClick={() => toast({ title: 'Saved', tone: 'success' })}>Save</Button>
    }
    
    <ToastProvider>
      <Save />
    </ToastProvider>

    Props

    PropTypeDefaultWhat it does
    children requiredstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | null | undefined
    closeLabelstring'Dismiss'Name of each close button.
    labelstring'Notifications'Accessible name of the toast area.

    Accessibility

    • Announced without moving focus.
    • Each tone has its own line pattern on the web as well as a colour.

    Do

    • Offer Undo where you can.

    Don’t

    • Use it for errors people must fix.