Composable toast notifications with stacking, swipe-to-dismiss, and an imperative manager API. Wrap your app in Toast.Provider, render a portal + viewport, and map active toasts to Toast.Root.
import Toast from "@radui/ui/Toast"Import all parts of the component and piece them together.
Wraps your app (or a subtree) and owns toast state, stacking, and the active toast manager.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
customRootClass | string | '' |
position | string | bottom-right |
expand | boolean | false |
gap | number | 14 |
limit | number | 3 |
maxToasts | number | — |
timeout | number | 5000 |
toastManager | ToastManager | — |
Renders toast children into the theme portal root (or document.body).
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
container | HTMLElement | null | theme portal / body |
The notifications region (<ol>) that measures heights, handles hover expand, and positions the stack.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | — |
className | string | '' |
One toast item (<li>): timers, swipe-to-dismiss, stack transforms, and live region semantics.
| Prop | Type | Default |
|---|---|---|
toast | ToastData | — |
children | ReactNode | — |
swipeDirection | 'up' | 'down' | 'left' | 'right' | Array | — |
anchor | Element | VirtualElement | RefObject | () => Element | — |
side | 'top' | 'right' | 'bottom' | 'left' | 'top' |
align | 'start' | 'center' | 'end' | 'center' |
sideOffset | number | 8 |
alignOffset | number | 0 |
className | string | '' |
Card wrapper around the toast body; forwards standard div attributes.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
children | ReactNode | — |
…props | HTMLAttributes<HTMLDivElement> | — |
Primary line of the toast; rendered as a <div> (not a heading) so transient notifications do not add to the page outline.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
children | ReactNode | — |
…props | HTMLAttributes<HTMLHeadingElement> | — |
Secondary copy for the toast; optional when only a title is shown.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
children | ReactNode | — |
…props | HTMLAttributes<HTMLParagraphElement> | — |
Optional action button; toast.actionProps are merged first, then your props.
| Prop | Type | Default |
|---|---|---|
type | string | button |
className | string | '' |
children | ReactNode | — |
…props | ButtonHTMLAttributes<HTMLButtonElement> | — |
Dismiss control; calls the item dismiss handler after any onClick you provide.
| Prop | Type | Default |
|---|---|---|
className | string | '' |
children | ReactNode | × |
onClick | function | — |
…props | ButtonHTMLAttributes<HTMLButtonElement> | — |
Accessibility
| Shortcut | Description |
|---|---|
| Tab | Moves focus through any interactive content inside visible toasts, including action and close buttons. Focusing the viewport expands the stack. |
| Shift + Tab | Moves focus to the previous focusable control and keeps the stack expanded while focus remains inside the viewport. |
| Enter | Activates the focused Toast.Action or Toast.Close button. |
| Space | Activates the focused Toast.Action or Toast.Close button. |
| Reference | What Rad UI follows |
|---|---|
| Live region properties | Each Toast.Root uses aria-live with aria-atomic so assistive technologies announce notification updates. High-priority toasts announce assertively; other toasts announce politely. |
| Button pattern | Toast.Action and Toast.Close render native buttons, so activation follows the standard button keyboard model. |
| Region role | Toast.Viewport exposes the notifications stack as a labelled region while preserving normal focus movement through interactive toast controls. |
Examples
useToastManager().promise() shows a loading toast, then resolves to success or error.
Pass toastManager={createToastManager()} to keep notifications separate from the default singleton.