Components
Feedback and overlays
Components that report status and progress, and panels that open over the page.
Choosing feedback
| Feedback | Use when | Persists | Interrupts | Announced as |
|---|---|---|---|---|
| Field message | One input is wrong or needs help. | Until fixed | No | Field description |
| Banner | A lasting issue with the page or data. | Until resolved or dismissed | No | status, or alert for errors |
| Prominent banner | An incident affecting everyone; one per page. | Until the incident ends | No | alert |
| Toast | A routine action succeeded and can be undone. | 8 seconds, paused on hover and focus | No | status, polite |
| Progress bar | A job takes more than a few seconds. | Until the job ends | No | progressbar with its value |
| Dialog | An irreversible decision, or input that cannot wait. | Until answered | Yes | Dialog with a title |
Escalate from field to banner to dialog. Toasts are only for confirmations.
Classification banner
A full-width ink bar with a lock glyph that states the classification of an official view. Never color-coded; prints in black.
The only uppercase text in the system. Place it first, above the app bar; repeat it at the foot of printed pages.
Component tokens
Toast
A brief confirmation that a routine action worked. Info and success close after 8 seconds, paused on hover or focus; warnings and errors stay until closed.
Use
- Completed, reversible actions, with Undo. Ctrl+Z presses it too.
- What changed, and on which record: "CR-20418 approved".
- One toast per action; replace, do not stack.
Avoid
- Errors that need action: use a banner or field message.
- Anything the person must read to continue.
Accessibility: the region is labelled "Notifications". Toasts are role="status", or role="alert" for errors, and always have a dismiss button.
Component tokens
Progress and skeleton
A progress bar shows a job's label, a count and a 4px fill. Skeleton rows hold a table's shape on its first load.
Use
- A count as the value: "428 of 1,200", not "36%".
- The same count in
aria-valuetext;--sg-progress-valueas a percentage. - No
aria-valuenowwhile the end is unknown; the fill then travels. - Skeleton rows at real row height,
aria-busyon the table, one status message. They show after 300ms, so a fast load never flashes them.
Avoid
- Progress bars under two seconds: use the button's busy state.
- Skeletons after the first load: dim the old rows.
- Whole-page skeletons: load each region in place.
Component tokens
Loader
An icon-sized spinning ring for waits with no count. Brand blue, or the text color in a button; half speed under reduced motion.
Use
aria-busy="true"on a busy button, loader first, label saying what is happening; orStingray.busy().- Visible text or
role="status"beside a standalone loader. sg-loader--large(48px, 4px ring) for a region.
Avoid
- A loader when there is a count: use a progress bar.
- A loader on a table's first load: use skeleton rows.
- More than one loader in view.
Dialog
A native <dialog> opened with showModal(): it traps focus, closes on Escape and returns focus to the opener. Its emblem is an octagon for destructive, a triangle for warning, a circle for information.
Use
- The action as a question: "Delete 3 records?".
- An impact list of what changes, IDs in tabular figures.
- Keys in the footer: Escape cancels. No Enter default on destructive dialogs.
- Buttons named for their result; Cancel left, confirm right.
data-sg-dismissible(click outside closes) on informational dialogs only.
Avoid
- Routine, reversible actions: use a toast with Undo.
- Nested dialogs, or dialogs opened by a timer.
- Click-outside dismissal with unsaved input or a destructive choice.
Component tokens
Drawer
A panel that slides in from an edge, keeping the page in view. Use it for details, filters or a short form.
| Size | Width | Use for |
|---|---|---|
sg-drawer--small | 320px | Filters and navigation. |
| Default | 480px | Record details and short forms. |
sg-drawer--large | 640px | Tables and two-column forms. |
Use
- The end edge for content; the start edge for filters and navigation.
- Previous and next buttons when showing one item of a list.
- Eyebrow for the kind, title for the name, subtitle for the key fact.
Avoid
- A quick yes or no: use a dialog.
- A dialog on top of a drawer.
- Long, multi-step work: use a page.
Accessibility: a native <dialog> opened with data-sg-dialog-open. Focus starts on the title and stays inside; Escape closes and returns focus to the opener.
Component tokens
Popover
A non-modal panel beside its button, for details, a short form or filters. It opens on any side, flips to fit, and closes on Escape or a click outside.
Use
- A few fields or facts tied to one button: filters, a quick edit, a number's breakdown.
data-side="end"beside a list or toolbar.
Avoid
- Long forms or required tasks: use a dialog or drawer.
- A popover inside a popover.
Accessibility: a non-modal role="dialog" named by its title. Focus moves to its first control on open and back to the button on close; the button has aria-expanded.
Component tokens
Hover card
A preview of a person or record after a 500ms hover on its link, or on focus. The pointer can enter it; leaving or Escape closes it. Show only what the link leads to.
Component tokens
Tooltip
Short text that adds to something visible. It opens after 400ms on hover or at once on focus, stays while hovered and closes on Escape. data-sg-tip-key adds the shortcut. Never the only copy of information; never a link or button.
Component tokens
Loading and live data
Rules for screens that wait on the server, and for data that changes while someone works.
| When | Do |
|---|---|
| A first load | Skeleton rows shaped like the content, shown only after 300ms. A fast answer shows none. Skeleton |
| A refresh | Keep the old data on screen. The provenance line says Updating, and the cells that changed are tinted for a moment. Updating |
| An action the server almost always accepts | Show the result at once. If the server refuses, put it back and say why in an error toast. |
| A reversible action | Do it at once and offer Undo in a toast; Ctrl+Z works too. No confirm dialog. Toast |
| A save, a send or a create | The button goes busy and ignores further presses. The request carries an Idempotency-Key, so a retry never makes a second copy. Busy button |
| A save that finished | A check and "Saved" for 600ms, then the panel closes. |
| New rows | A "N new, show them" bar. Nothing reorders under the pointer. |
| A timer | One announcement when it crosses into at risk or breached. |
Avoid
- Moving what the person is about to touch.
- Announcing every change or every timer tick.
- Skeleton rows after the first load, or a spinner over the whole page.
- Moving focus or clearing a draft.
Haptics
A short tap on a phone when a switch flips, a swipe is about to dismiss, or an action is done. The phone's own settings apply, and every product offers a switch to turn it off.
Use
- A "Haptic feedback" switch in the product's settings.
- Only the taps Stingray plays.
Avoid
- A tap on every press, scroll or keystroke.
- A tap as the only sign that something happened.
Writing feedback
Say what happened, why, and what to do. No exclamation marks, "Oops", emoji or blame.
3 records could not be saved. The citizen ID is missing. Add it to each marked record and save again.
Oops! Something went wrong. Please try again later!
3 records approved.
Success! Your action was completed successfully!!