import { Canvas, Meta, Story, Source, ArgTypes } from '@storybook/blocks'; import * as Stories from './index.stories'; import { toast } from './DocUtils'; import { ToastProvider } from './ToastProvider'; import { Toast } from './index'; # Toast Cunningham provides a powerful Toast component for displaying any kind of information for a defined amount of time. ## Usage Toasts are really simple to use, you need to wrap your app inside `CunninghamProvider`. ( ); `} /> And then simply use the `toast` function from `useToastProvider` hook. { const { toast } = useToastProvider(); return ( ); }; `}/> You can also customize the appearance of the toast with the `toast` function. See the API. ## Type Toast can be of different types, each type has a different color and icon. ## Actions You can quickly add an action to your toast by passing `primaryLabel` and `primaryOnClick` props to the `toast` function. ## Customize You can customize the appearance of the toast by passing `actions` when calling `toast` function. ## Props These are the props of `Toast` component which you might not need to create by yourself as the `toast` function does all the heavy lifting for you. ## Design tokens Here a the custom design tokens defined by the Toast. | Token | Description | |--------------- |----------------------------- | | slide-in-duration | Time the toast takes to slide in | | slide-out-duration | Time the toast takes to slide out | | background-color | Default background color | | color | Color of the content | | font-weight | Font weight of the content | | icon-size | Size of the left icon | | progress-bar-height | Height of the progress bar |