Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    Toast

    Provides a brief notification.

    View source code
    • Usage
    • Props
    • Accessibility

    Basic usage

    <Toast title="Your receipt has been uploaded" onClose={() => closeToast()} />
    

    Variant

    The Toast comes with two visual styles: success (default) and alert.

    <>
      <Toast
        title="Your receipt has been uploaded"
        variant="success"
        onClose={() => closeToast()}
      />
      <Toast
        title="Your receipt has been uploaded"
        variant="alert"
        onClose={() => closeToast()}
      />
    </>
    

    Content

    Use the children prop to add any content to the Toast.

    <Toast title="Your receipt has been uploaded" onClose={() => closeToast()}>
      Description (optional)
    </Toast>
    

    Action

    Use the action prop to add a button (action) to your Toast. Only one action is supported.

    <Toast
      title="Your receipt has been uploaded"
      onClose={() => closeToast()}
      action={{
        text: "Action",
        onClick: () => {},
      }}
    />
    

    Sticky

    Setting the canExpire prop to false will make the Toast component stay on the page. No timer will be shown to be user.

    <Toast
      title="Your receipt has been uploaded"
      onClose={() => closeToast()}
      canExpire={false}
    />
    
    Your receipt has been uploaded
    Your receipt has been uploadedYour receipt has been uploaded
    Your receipt has been uploaded

    Description (optional)

    Your receipt has been uploaded
    Your receipt has been uploaded