about summary refs log tree commit diff
path: root/src/components/Toast/types.ts
blob: 9f1245fa22712502aa8f55ea51e357d9d243b769 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info'

export type ToastApi = {
  show: (props: {
    /**
     * The type of toast to show. This determines the styling and icon used.
     */
    type: ToastType
    /**
     * A string, `Text`, or `Span` components to render inside the toast. This
     * allows additional formatting of the content, but should not be used for
     * interactive elements link links or buttons.
     */
    content: React.ReactNode | string
    /**
     * Accessibility label for the toast, used for screen readers.
     */
    a11yLabel: string
    /**
     * Defaults to `DEFAULT_TOAST_DURATION` from `#components/Toast/const`.
     */
    duration?: number
  }) => void
}