Skip to content

Toast

A component for displaying a notification to the user.

See all the examples and details in the Storybook.

Usage

tsx
import { Toast } from "@samgl/graffiti-ui";

const MyToast = () => {
  return (
    <Toast
      title="You have a new message in your inbox"
      description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut odio sit amet metus semper scelerisque ut fringilla turpis."
      buttons={[
        {
          text: "Cancel",
          onClick: () => {
            console.log("Cancel");
          },
        },
        {
          text: "Okay",
          isPrimary: true,
          onClick: () => {
            console.log("Okay");
          },
        },
      ]}
    />
  );
};

Props

PropTypeDefaultOptionalDescription
titlestringThe title of the toast.
descriptionstringThe description of the toast.
buttonsToastProps[buttons]An array of buttons to display in the toast.
classNamestringThe class name of the component, generally used when extending the component with a styled component.