Internal ID software / Status and waiting
FlashMessage
What the page says about the thing you just did. In the flow, not a toast.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/message.tsx. From the old system: FlashMessage in @id-identity-as/ui/commerce.
Example
Ordren er gemt
Antal ændret fra 24 til 48.
Ordren blev ikke gemt
Prøv igen. Bliver det ved, så kontakt support.
Ordren er gemt
Antal ændret fra 24 til 48.
Ordren blev ikke gemt
Prøv igen. Bliver det ved, så kontakt support.
import { FlashMessage } from '@/components/software/message';
<FlashMessage title="Ordren er gemt">Antal ændret fra 24 til 48.</FlashMessage>
<FlashMessage tone="alert" title="Ordren blev ikke gemt">Prøv igen, eller kontakt support.</FlashMessage>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
title (required) | string | What happened, as a short sentence. | |
tone | 'status' | 'alert' | 'status' | Status is news that can wait its turn. Alert interrupts, for when something failed. |
id | string | 'besked' | A stable id, so the page that follows an action can send focus to the message. |
action | ReactNode | One way on from here, such as a link. | |
children | ReactNode | The detail under the title. |
Do
- Place it at the top of the content, and leave it until the next navigation.
- Send focus to it after a redirect, so the outcome is the first thing read.
- Use alert only when something failed and the reader must act.
Do not
- Do not make it disappear on a timer. A confirmation gone before it is read was never given.
- Do not float it over the page as a toast.
- Do not colour an alert red. It is marked by a doubled edge in the text colour.
Accessibility
- role="status" is read when the reader is free; role="alert" interrupts.
- It can take focus from script (tabindex -1) without joining the tab order.
Tokens it uses
- color.surface.base
- color.border.default
- color.text.default
- radius.sm
- type.heading.md
- type.body.md
- space.inline.1
- space.inline.3
- space.inline.4