Feedback
Toast
Transient confirmation in a live region.
import { Toast, ToastRegion } from 'faifo-design'Toast confirms something that just happened, or reports background work with its progress.
ToastRegion is the live region that announces them.
#When to use
- Use it for a result that needs no decision: saved, sent, copied.
- An error the reader must act on stays on the page as a
Noticeor a field error.
#Examples
Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.
#Transient feedback and loading
Live-region toasts (one reporting background work with progress), compact progress and content skeletons share state rules.
All changes are synchronized.
products-october.csv · Started by Linh
Show codeHide code
import { Inline, Skeleton, Spinner, Stack, ToastRegion } from 'faifo-design'
export const Example = () => (
<Stack
items={[
<Inline items={[<Spinner label="Saving record" />, <span>Saving record</span>]} />,
<Skeleton label="Loading customer summary" lines={3} />,
<ToastRegion
label="Notifications"
toasts={[
{
id: 'saved',
title: 'Record saved',
message: 'All changes are synchronized.',
tone: 'positive',
},
{
id: 'importing',
title: 'Importing products',
message: 'products-october.csv · Started by Linh',
tone: 'info',
progress: { value: 40, label: '180 of 450 rows' },
},
]}
/>,
]}
/>
)#API
Generated from the package source. A property without a description has none in the source yet.
#ToastComponent
| Property | Description | Type | Default |
|---|---|---|---|
idrequired | – | string | – |
titlerequired | – | string | – |
message | – | string | – |
tone | – | Tone | 'neutral' |
actions | – | JSXChild | – |
progress | How far the work this toast reports has got, for work that runs in the background (an import). The bar and its label are not announced: a live region would read every update, so the title and message carry what a reader must hear (started, finished). | { value: number; label: string } | – |
#ToastRegionComponent
| Property | Description | Type | Default |
|---|---|---|---|
labelrequired | – | string | – |
toastsrequired | – | readonly ToastProps[] | – |
#Types
#ToastProps
The properties of Toast, listed above.
#Hooks
The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.
toast-regiontoasttoast-copytoast-titletoast-messagetoast-actionstoast-progress