{"slug":"toast","name":"Toast","category":"Overlays","summary":"A single transient notification driven by the toast store.","status":"stable","since":"0.1.0","import":"import { Toast } from '@elluzion/iv-ui';","usage":["Mount `<Toast />` once in the root layout.","Call `showToast(message, type, durationMs)`; only one toast is visible at a time.","`hideToast()` clears it immediately; an id guard stops an old timer from closing a newer toast."],"props":[],"events":[],"snippets":[],"types":[],"manual":[{"title":"Functions","rows":[{"name":"showToast(message, type?, durationMs?)","type":"(message: string, type?: ToastType, durationMs?: number) => void","description":"Shows a toast, replacing the current one. The default duration is 5000 ms."},{"name":"hideToast(id?)","type":"(id?: number) => void","description":"Hides the toast. With an id, only hides it when that toast is still active."},{"name":"toastState","type":"Writable<ToastState | null>","description":"Store holding the active toast, or `null` when hidden."}]},{"title":"Options","rows":[{"name":"type","type":"'info' | 'success' | 'error'","description":"Controls the icon and accent. Defaults to `info`."},{"name":"durationMs","type":"number","description":"Visible time in milliseconds; clamped to at least 800 ms."}]}],"tokens":["--iv_border","--iv_error","--iv_error-dim","--iv_font-mono","--iv_foreground","--iv_info","--iv_outline-offset","--iv_outline-width","--iv_radius-sm","--iv_shadow-md","--iv_spacing-md","--iv_spacing-sm","--iv_success","--iv_surface-overlay","--iv_surface-raised","--iv_text-body","--iv_toast-close-size","--iv_toast-min-w","--iv_z-toast"],"cssHooks":["iv-close","iv-content","iv-toast","iv-toast-error","iv-toast-info","iv-toast-layer","iv-toast-success"],"accessibility":{"notes":["The layer uses `role=\"status\"` with `aria-live=\"polite\"` for info and success.","Errors use `role=\"alert\"` with `aria-live=\"assertive\"`.","The dismiss control has an accessible name.","Only one toast exists at a time, so messages do not stack up."]},"related":[{"title":"Alert","summary":"An inline message for information, success, warning, or error.","url":"/components/alert","kind":"Component"},{"title":"Dialog","summary":"A modal surface for focused tasks and confirmations.","url":"/components/dialog","kind":"Component"},{"title":"Popover","summary":"A floating panel anchored to an element.","url":"/components/popover","kind":"Component"},{"title":"Badge","summary":"A compact label for status, counts, or categories.","url":"/components/badge","kind":"Component"}],"examples":[{"id":"types","title":"Types","description":"Info, success, and error; the last one is announced assertively.","code":"<script lang=\"ts\">\n\timport { Button, showToast, Toast } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"row\">\n\t<Button variant=\"outline\" onclick={() => showToast('Build queued for main.', 'info')}>\n\t\tInfo\n\t</Button>\n\t<Button variant=\"outline\" onclick={() => showToast('Deployed to production.', 'success')}>\n\t\tSuccess\n\t</Button>\n\t<Button variant=\"outline\" onclick={() => showToast('Deploy failed: exit code 1.', 'error')}>\n\t\tError\n\t</Button>\n\t<Toast />\n</div>\n\n<style>\n\t.row {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tjustify-content: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"duration","title":"Duration","description":"The third argument sets the visible time in milliseconds.","code":"<script lang=\"ts\">\n\timport { Button, showToast } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"row\">\n\t<Button variant=\"outline\" onclick={() => showToast('Quick confirmation', 'success', 2000)}>\n\t\t2 seconds\n\t</Button>\n\t<Button variant=\"outline\" onclick={() => showToast('Longer confirmation', 'info', 10000)}>\n\t\t10 seconds\n\t</Button>\n</div>\n\n<style>\n\t.row {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tjustify-content: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"dismiss","title":"Dismiss","description":"`hideToast()` closes the current toast from your own control.","code":"<script lang=\"ts\">\n\timport { Button, hideToast, showToast } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"row\">\n\t<Button variant=\"outline\" onclick={() => showToast('Waiting for your response…', 'info', 30000)}>\n\t\tShow\n\t</Button>\n\t<Button variant=\"ghost\" onclick={() => hideToast()}>Dismiss</Button>\n</div>\n\n<style>\n\t.row {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tjustify-content: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"}],"markdown":"/components/toast.md","page":"/components/toast"}