Toast

Fixed-position notification with auto-dismiss, slide-in animation, and 4 severity variants.

Basic

import { useState } from 'react'
import { Toast, Button } from '@canarist/ui'

function Example() {
  const [open, setOpen] = useState(false)
  return (
    <>
      <Button onClick={() => setOpen(true)}>Show Toast</Button>
      <Toast
        variant="success"
        title="Saved successfully"
        description="Your changes have been saved."
        open={open}
        onClose={() => setOpen(false)}
      />
    </>
  )
}

Variants

<Toast variant="success" title="Changes saved" open={open} onClose={onClose} />
<Toast variant="error" title="Something went wrong" open={open} onClose={onClose} />
<Toast variant="warning" title="Quota nearly full" open={open} onClose={onClose} />
<Toast variant="info" title="New alerts available" open={open} onClose={onClose} />

Reference

PropTypeDefaultDescription
openbooleanWhether the toast is shown.
onClose() => voidCalled after the dismiss animation completes.
variant'success' | 'error' | 'warning' | 'info''info'Semantic variant controlling icon and border color.
titlestringPrimary message text.
descriptionstringSecondary detail text.
action{ label: string; onClick: () => void }Optional inline action button.
durationnumber5000Auto-dismiss delay in ms. Set to 0 to disable.