Render one Toaster in a ToastProvider near the app root, then call toast.add() from anywhere. Give a toast with an action a longer timeout, so a keyboard user can reach it.
delete-file.tsx
ToastPortal
<div>| Prop | Type | Default | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
From Base UIToast.PortalBase UI docs | ||||||||||
| container | — | A parent element to render the portal element into. | ||||||||
| class | — | CSS class applied to the element, or a function that returns a class based on the component's state. | ||||||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | ||||||||
| ||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||
ToastViewport
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| position | "bottom-center""bottom-end""bottom-start""top-center""top-end""top-start" | "bottom-end" | |
| class | string | — | |
| variant | "default""inverse" | "default" | The look of every toast in this viewport: default (the popover surface) or inverse (the foreground surface). One look per stack: mixed looks in a collapsed stack show a dark card peeking out under a light one. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
Toast
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| swipe | — | Directions that dismiss it. By default: toward the edge and the side of the viewport. | |
From Base UIToast.RootBase UI docs | |||
| toast | ToastRootToastObject<any> | — | The toast to render. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastContent
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastIcon
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| type | string | — | The toast type. success, destructive, warning, and info show an icon, loading a spinner. The error type of Base UI toast.promise shows as destructive. |
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
ToastHeader
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastTitle
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastDescription
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastAction
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastClose
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
ToastPositioner
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
From Base UIToast.PositionerBase UI docs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| position | "absolute""fixed" | 'absolute' | Determines which CSS position property to use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| side | number | OffsetFunction | 0 | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a data object parameter with the following properties: - data.anchor: the dimensions of the anchor element with properties width and height. - data.positioner: the dimensions of the positioner element with properties width and height. - data.side: which side of the anchor element the positioner is aligned against. - data.align: how the positioner is aligned relative to the specified side. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align | "center""end""start" | 'center' | How to align the popup relative to the specified side. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
ToastArrow
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
Toaster
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| variant | "default""inverse" | — | The look of every toast in this viewport: default (the popover surface) or inverse (the foreground surface). One look per stack: mixed looks in a collapsed stack show a dark card peeking out under a light one. |
| position | "bottom-center""bottom-end""bottom-start""top-center""top-end""top-start" | — | |
| container | — | Where the viewport renders (Base UI Toast.Portal). By default, the end of <body>. | |
| close | string | — | The accessible name of each close button ("Close" by default). Translate it with the page. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
AnchoredToaster
<div>| F6 | Moves focus into the toasts and pauses every timer. |
|---|---|
| ShiftTab | Moves focus back out of the toasts. |
| Esc | Closes the focused toast. |
- AlertPick Alert for a message that must stay in the page until its cause goes away.
- Alert DialogPick Alert Dialog when people must answer yes or no before they go on.
- ButtonA button for an action on the page, such as Save or Delete. It has 9 looks and 5 sizes, and a spinner that keeps its width while the action runs.
Built with
Installs with Toast





