Save bar
A bar that rises from the bottom of the screen while a form has unsaved changes, with Discard and Save. It shows the save running, leaves once it has worked, and swells to say no when the person tries to leave first.
npx shadcn add https://kinoui.com/r/save-bar.jsonCopy install command
Examples
Default
Put it in a Form, after the fields, and save in onFormSubmit: change a field and the bar rises; a promise shows the save running, and the bar leaves once it has worked.
Failing save
A rejection or a throw from onFormSubmit keeps the changes and says the save failed, so the person can try again.
Controlled
Discard puts every Field back to its defaultValue; put state you own back in onDiscard.
Installation
Copy code
npx shadcn@latest add https://kinoui.com/r/save-bar.json- Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/label.tsxlib/settle.tscomponents/kino/field.tsxlib/announce.tsxlib/keys.tsxlib/refuse.tslib/scroll.tslib/form-changes.tsxcomponents/kino/save-bar.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
SaveBar
SaveBarContainer
Data attributes
CSS variables
Accessibility
- The bar is a region named “Unsaved changes”, read after the form’s last field though it renders at the end of the page. It never takes focus as it appears, so typing carries on; Tab reaches it after the form’s last field, and Tab from Save goes on to what follows the form.
- A polite status region, there from the start, says when the bar shows, when a save starts, when it has worked, when it fails and when changes are discarded.
- ⌘S or Ctrl+S saves while there are changes; Save carries the shortcut in
aria-keyshortcuts. Escape does nothing, so changes are never thrown away by a key. - With changes unsaved, a link away or Back is stopped and the bar says to save or discard first, in words and in the warning colour, not by its swell alone; closing or reloading the tab asks the browser’s own question.
- A focused field the bar would cover is scrolled clear of it. When the bar leaves with focus in it, focus goes back to the control last used.
- Under reduced motion the bar fades in and out where it rests, and doesn’t swell; every state still shows in words.