Skip to the page
Supply UI

Toast mark

In code: ToastMark

The mark of a toast's kind (success, info, warning, error, loading); nothing for a plain message

Preview

Backup finishedAll 286 clients, 03:00
Card expires soonEnding 4417, in December
Reminder not sentThe address bounced
Sending invoices12 of 40

Use

The code of the preview above
import { Card, ItemText, Row, Stack, ToastMark } from '@/components/ui';

<Stack gap={3}>
  <Row nowrap gap={2}><ToastMark type="success" /><ItemText title="Backup finished" note="All 286 clients, 03:00" /></Row>
  <Row nowrap gap={2}><ToastMark type="warning" /><ItemText title="Card expires soon" note="Ending 4417, in December" /></Row>
  <Row nowrap gap={2}><ToastMark type="error" /><ItemText title="Reminder not sent" note="The address bounced" /></Row>
  <Row nowrap gap={2}><ToastMark type="loading" /><ItemText title="Sending invoices" note="12 of 40" /></Row>
</Stack>

This page as text, for an AI

Options

OptionTypeWhat it does
type stringThe toast's kind: success, info, warning, error or loading; anything else shows no mark.

Without React

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/button.csscomponents/loading.csscomponents/toast.csscomponents/icons.csscomponents/button-group-toggle.csscomponents/carousel-arrows.css

Helpers: states, do and don’t

The round mark a toast shows (success, info, warning, error, loading), for a message shaped like a toast that is not one.

Hooks and functions the components are made of, passed on so a project uses the same ones: keyboard shortcuts, options loaded while typing, search matching, saved preferences, screen-reader announcements, smooth sizes, the theme.

Do

  • Use useShortcut for app-wide keys, and show the key with formatShortcut so it reads right on each computer.
  • Use announce() to tell a screen reader what changed when nothing visible takes focus ("3 results").

Don't

  • Don't turn off the smooth sizes Toaster starts; boxes would jump when their content changes.