# Toast

A Primitives toast styled with Themes tokens, buttons and text.

The [Toast primitive](/primitives/docs/components/toast) owns the live region, the hotkey to focus the viewport, pause on hover and focus, swipe to dismiss and the timer. Themes tokens style the root and viewport; Themes `Button` renders the trigger and the `Toast.Close` dismiss control.

```tsx
() => {

	const [open, setOpen] = createSignal(false);

	return <Toast.Provider swipeDirection="right">

		<Button onClick={() => setOpen(true)}>Show notification</Button>

		<Toast.Root open={open()} onOpenChange={setOpen} style={{ display: "grid", "grid-template-columns": "1fr auto", "align-items": "center", gap: "var(--space-1) var(--space-3)", padding: "var(--space-3)", "border-radius": "var(--radius-4)", background: "var(--color-panel-solid)", "box-shadow": "var(--shadow-5)" }}>

			<Toast.Title asChild>{target => target(Text, { size: "2", weight: "bold", children: "Example notification" })}</Toast.Title>

			<Toast.Description asChild>{target => target(Text, { size: "2", color: "gray", style: { "grid-column": "1" }, children: "Dismiss it, swipe it right or let the timer close it." })}</Toast.Description>

			<Toast.Close asChild>{target => target(Button, { size: "1", variant: "soft", style: { "grid-column": "2", "grid-row": "1 / span 2" }, children: "Dismiss" })}</Toast.Close>

		</Toast.Root>

		<Toast.Viewport style={{ position: "fixed", bottom: "0", right: "0", display: "flex", "flex-direction": "column", gap: "var(--space-3)", padding: "var(--space-5)", width: "360px", "max-width": "100vw", margin: "0", "list-style": "none", "z-index": "2147483647", outline: "none" }} />

	</Toast.Provider>;

}
```

The original demo with every styling solution, enter and swipe animations and a runnable sandbox is on the [Toast primitive page](/primitives/docs/components/toast).
