Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. Feedback
  4. SaveBar and TopLoadingBar

Feedback

SaveBar and TopLoadingBar

SaveBar appears while a form has unsaved changes, with Save and Discard and ⌘S to save. TopLoadingBar is a thin progress line at the top of the window while a page loads.

import { SaveBar, TopLoadingBar } from '@alea/ui';

Examples

Save bar

Edit the field: the bar appears with Save and Discard, and ⌘S or Ctrl+S saves. It is announced to screen readers when it appears.

Top loading bar

A thin bar at the top of the window while a page loads: it creeps on its own, or follows a value, then completes and fades.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-border-strong…
  • --alea-status-warning…
  • --alea-surface-overlay…
  • --alea-text…

Space

  • --alea-space-2…
  • --alea-space-4…

Radius

  • --alea-radius-full…
  • --alea-radius-lg…

Type

  • --alea-font-size-md…
  • --alea-font-weight-medium…

Shadow

  • --alea-shadow-pop…

Motion

  • --alea-motion-duration-base…
  • --alea-motion-ease-out…

Layer

  • --alea-z-toast…

Props

SaveBar props

A bar that appears while a form has unsaved changes, with Save and Discard. Announced to screen readers when it appears; ⌘S saves.

PropTypeDefaultDescription
isVisiblerequiredboolean-Show it while there are unsaved changes.
onSaverequired() => void-Saves the changes.
discardLabelReactNode-Label of the discard button. Default "Discard".
isSavingboolean-Shows a spinner on Save while it works.
messageReactNode-The message. Default "Unsaved changes".
onDiscard(() => void)-Throws the changes away.
position"bottom" | "top"'top'Where it shows: top (over the header, default) or bottom.
saveLabelReactNode-Label of the save button. Default "Save".
saveShortcutbooleantrue⌘S / Ctrl+S saves while it is visible. Default true.

TopLoadingBar props

A thin bar at the very top of the window while a page loads: it creeps forward, then completes and fades.

PropTypeDefaultDescription
isLoadingrequiredboolean-Shows the bar while a page or a big request loads.
aria-labelstring-Name for screen readers. Default "Loading".
valuenumber-A known progress from 0 to 100; without it the bar creeps forward on its own.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

SaveBar

Variants
positionbottomtop
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-savebar.alea-savebar-message.alea-savebar-actions
Data attributes
data-position=topdata-position=bottomdata-visible

TopLoadingBar

States
Indeterminate
Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-top-loading.alea-top-loading-bar
Data attributes
data-done

Accessibility

  • The save bar is a named region; its message is announced politely when it appears.
  • Hidden, it is removed from the keyboard and the accessibility tree.
  • The loading bar is a progressbar named Loading, with its value when you pass one.

Keyboard

KeyDoes
⌘S / Ctrl+SSaves while the bar shows

Do and don't

Do

  • Show the save bar only when something really changed.
  • Keep Discard: people need a way back.

Don't

  • Don't also auto-save the same form: pick one.
Tested with axe, keyboard and screen reader roles