Toast API

API documentation for Toast component

Toast#

Props#

Defines valid properties in Toast component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastInstance) => ReactNode)
null
The children to render.
richColorsboolean
false
Whether to show rich colors
positionToastPosition
'top-right'
Position of the toast container
expandboolean
false
Whether to expand the toast on hover
durationnumber
6000
Duration in milliseconds for toast auto-dismiss
gapnumber
14
Gap between toasts in pixels
timeoutnumber
6000
Timeout for toast auto-dismiss (alias for duration)
swipeDirectionToastSwipeDirection[]
['right']
Allowed swipe directions for dismissing toasts
iconsPartial<Record<ToastVariant, ReactNode>>
null
Custom icons for each toast variant
groupstring
null
Group identifier for toast grouping
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Toast component.

nametypedefaultdescription
isExpandedboolean
null
Whether the toast container is expanded (showing all toasts)
isInteractingboolean
null
Whether user is currently interacting with toasts

Exposes#

Defines the methods and properties exposed by Toast component.

nametypedefaultdescription
toastsToastType[]
null
Array of filtered toasts for the current group
onRegionMouseEnter() => void
null
Handler for mouse enter on the toast region
onRegionMouseLeave() => void
null
Handler for mouse leave on the toast region
onRegionMouseMove() => void
null
Handler for mouse move on the toast region
onRegionDragEnd() => void
null
Handler for drag end on the toast region
onRegionPointerDown(event: PointerEvent) => void
null
Handler for pointer down on the toast region
onRegionPointerUp() => void
null
Handler for pointer up on the toast region
setToastsDispatch<SetStateAction<ToastType[]>>
null
Function to update the toasts state
handleFocusElement(toastElement: HTMLElement) => void
null
Handler for managing focus when a toast is dismissed
handleToastFocus() => void
null
Handler for storing focus when a toast receives focus

Interfaces#

Defines passthrough(pt) options of Toast component.

nametypedefaultdescription
rootToastPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of Toast component.

values
ComponentInstance<ToastProps, ToastState, ToastExposes>

ToastRegion#

Props#

Defines valid properties in ToastRegion component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastRegionInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastRegionInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastRegionPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastRegionInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ToastRegion component.

nametypedefaultdescription
toastToastInstance
null
The Toast component instance.

Interfaces#

Defines passthrough(pt) options of ToastRegion component.

nametypedefaultdescription
rootToastRegionPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastRegion component.

values
ComponentInstance<ToastRegionProps, ToastRegionState, ToastRegionExposes>

ToastItem#

Props#

Defines valid properties in ToastItem component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastItemInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastItemInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastItemPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastItemInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of ToastItem component.

nametypedefaultdescription
rootToastPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastItem component.

values
ComponentInstance<ToastItemProps, ToastItemState, ToastItemExposes>

ToastTitle#

Props#

Defines valid properties in ToastTitle component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastTitleInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastTitleInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastTitlePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastTitleInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by ToastTitle component.

nametypedefaultdescription
toastItemToastItemInstance
null
The ToastItem component instance.

Interfaces#

Defines passthrough(pt) options of ToastTitle component.

nametypedefaultdescription
rootToastTitlePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastTitle component.

values
ComponentInstance<ToastTitleProps, ToastTitleState, ToastTitleExposes>

ToastDescription#

Props#

Defines valid properties in ToastDescription component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastDescriptionInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastDescriptionInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastDescriptionPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastDescriptionInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of ToastDescription component.

nametypedefaultdescription
rootToastPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastItem component.

values
ComponentInstance<ToastDescriptionProps, ToastDescriptionState, ToastDescriptionExposes>

ToastIcon#

Props#

Defines valid properties in ToastIcon component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastIconInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastIconInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastIconPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastIconInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of ToastIcon component.

nametypedefaultdescription
rootToastPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastItem component.

values
ComponentInstance<ToastIconProps, ToastIconState, ToastIconExposes>

ToastAction#

Props#

Defines valid properties in ToastAction component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastActionInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastActionInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastActionPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastActionInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of ToastAction component.

nametypedefaultdescription
rootToastPassThroughType<ButtonHTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastAction component.

values
ComponentInstance<ToastActionProps, ToastActionState, ToastActionExposes>

ToastClose#

Props#

Defines valid properties in ToastClose component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: ToastCloseInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: ToastCloseInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<ToastClosePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: ToastCloseInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Interfaces#

Defines passthrough(pt) options of ToastClose component.

nametypedefaultdescription
rootToastPassThroughType<ButtonHTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of ToastClose component.

values
ComponentInstance<ToastCloseProps, ToastCloseState, ToastCloseExposes>

useToast#

Props#

State#

Exposes#

Interfaces#

Types#

useToastItem#

Props#

State#

Exposes#

Interfaces#

Types#