Persist 1.2.2
Wrap a form (or field group) in <velin-persist> to debounce-save named inputs to localStorage (default) or sessionStorage. Password and file inputs are never stored. Supports WCAG 2.2 3.3.7 Redundant Entry; listed in core/a11y/component-contracts.json (framework audit: pass). Deutsch: Persist De
Maturity: Documented as stable in VelinStyle 1.2.0. Design Intelligence (plan / review / agent meta) is separate and beta / foundation where noted.
When to use
- Remember non-sensitive UI state (draft field values, toggles) across reloads with
<velin-persist>. - Reducing re-entry for forms or preferences when the documented storage pattern fits.
When not
- Secrets, tokens, or payment data — never persist sensitive values in client storage.
- Server-of-record application state — use your backend; this is a client convenience only.
Basic
<velin-persist key="contact-draft">
<form>…</form>
</velin-persist>
Attributes
| Attribute | Default | Notes |
|---|---|---|
key | default | Storage suffix (velin-persist-{key}); alphanumeric + _- |
storage | local | session for sessionStorage |
JavaScript API
document.querySelector('velin-persist').clear();
Also clears on form submit and reset.
Events
velin-persist-restore— after values are appliedvelin-persist-clear— storage entry removedvelin-persist-error— e.g.detail.error === 'quota'
Security
Never persist secrets: type="password" and type="file" are skipped. Max payload 64 KB per key. For PII in source, run npx velinstyle scan --only pii.
Accessibility
- Persisted fields should still have visible labels and the same validation affordances as normal inputs.
- Tell users when a draft was restored if that surprise would affect their decisions.