Toast

The Toast component provides brief notifications to inform users of important events or actions.

Usage & Examples

Default

default.tsx

    const { addToast } = useToast();
  
      <Button
        onClick={() =>
          addToast({
            title: "Saved",
            message: "Settings were updated.",
            state: "success",
            duration: 0,
          })
        }
      >
        Show toast
      </Button>
  

Props API

9 props
Columns
Toast props API
Default
Description
childrenReactNodeNopropsContent rendered inside the component.
classNamestringNostylingAdditional CSS class names for the component root.
data-testidstringNotestingTest id used to identify the component in tests.
defaultDurationnumberNoprops5000Default Duration.
placementPositionTypeNoprops"topRight"Placement.
roundingRoundableRoundingTypeNostylingconfigured default rounding (fallback: "medium")Rounding.
shadowShadowTypeNostylingconfigured default shadow (fallback: "light")Shadow.
testIdstringNopropsTest id used to identify the component in tests.
toastClassNamestringNopropsAdditional CSS class names for the toast section.