Calm motion: animations on this site only fade, with no movement
Saved form
A long form that saves a draft in the browser and offers to go on with it later
Keeps the work of a person who fills a long form, such as a permit or a grant request, if they close the page or lose the connection.
Basic
- Put your fields in the default slot.
v-modelholds all the values in one object. - After each change and a wait of
delaymilliseconds (default 600), the form saves a draft inlocalStorageunderstorage-key. A status line says when. - When the form opens and finds a draft that differs from the values, it asks: "Go on with the draft" or "Start again". It does not save until the person chooses.
- "Save and come back later" saves at once and emits
later. Send emitssubmitand deletes the draft. - If the browser blocks storage, as in some private windows, the form still works without drafts.
The draft stays on the device. Do not use it for secrets, such as passwords or card numbers. On a shared computer, the next person can see the draft. For a long form that people fill on many devices, save the draft on your server.
Usage
ts
import { BlessSavedForm } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
storageKey* | string | — | the key of the draft in localStorage; make it unique for each form and each person |
delay | number | 600 | the wait after the last change before a save, in milliseconds |
locale | string | "en" | |
labels | Partial<{ found: (time: string) => string; resume: string; restart: string; saved: (time: string) => string; later: string; send: string; }> | — | |
modelValue | Values | {} |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: Values] | |
submit | [values: Values] | |
later | [values: Values] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |