Toast
Transient, non-blocking feedback delivered through the Innate provider.
ToastView sourceExample
The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.
import { Button, Toast } from "innate-ui";
import { Icon } from "@/docs/icons/Icon";
export function ToastDemo() {
const { showToast } = Toast.useToast();
const showNotification = () => {
void showToast({
content: (
<>
<Toast.Icon>
<Icon name="statusSuccess" />
</Toast.Icon>
<Toast.Content>
<strong>Toast created</strong>
<span>This is a toast notification.</span>
</Toast.Content>
</>
),
duration: 4000,
tone: "success",
});
};
return <Button onClick={showNotification}>Give me a toast</Button>;
}API reference
This table is generated from Innate UI's exported TypeScript declarations and JSDoc. Native element attributes inherited by a prop type are not repeated here.
ToastOptions
| Prop | Type | Default |
|---|---|---|
contentrequiredToast content. | JSX.Children | — |
durationLifetime in milliseconds. Use `null` to keep the toast open until dismissed. | JSX.ValueOrCell<number | null> | — |
toneVisual and semantic tone of the toast. | JSX.ValueOrCell<ToastTone> | "neutral" |
onClickCalled when the toast is activated by pointer or keyboard. | (event: MouseEvent | KeyboardEvent) => void | — |
InnateProviderProps
| Prop | Type | Default |
|---|---|---|
childrenrequiredApplication content that can use Innate's shared services. | JSX.Children | — |
tooltipDelayDelay in milliseconds before the first tooltip opens. | number | 350 |
tooltipSkipDelayWarm period in milliseconds during which subsequent tooltips open immediately. | number | 300 |