IFFDAYIFFDAYDesign
Controls

Toast

One notification at the bottom of the screen, gone after 6.5 seconds.

import { NotificationHost } from '@iffday/ui';

Example

A toast is a dark bar centred at the bottom of the screen. There is only ever one: a new toast replaces the last, and each disappears after 6.5 seconds. An error toast has a brand red edge on the left.

The first button sends a plain toast and the second an error.

Usage

  • Pages never render NotificationHost themselves; AppProvider puts it at the bottom of every page. A page calls useApp().notify(message, type).
  • message can be a message key, such as an error key from the API, and is translated for the reader.
  • For saves use useAction().run(): it sends Saved, or your own text, on success, and an error toast on failure.

Props

PropTypeDefault
notification*Notification | null
onDismiss*() => void