This is the legacy documentation for Superforms 0.x. The 1.0 version can be found at superforms.rocks!

Snapshots

A quite recent SvelteKit feature is snapshots, which saves and restores data when the user navigates in the browser history. This is perfect for saving the form state, and with Superforms you can take advantage of this in one line of code.

Usage

const { form, capture, restore } = superForm(data.form);

export const snapshot = { capture, restore };

Test it out

Modify the form below without submitting, then click the browser back button and then forward again. The form should be restored to its intermediate state. (taintedMessage is set to null for this example.)