Open History to see the last commit
const createForm: CreateForm;
Defined in: packages/svelte-form/src/createForm.public.ts:53
Creates a Svelte form whose instance and lifecycle are owned by the current component.
Pass an options function. defaultValues establish the initial state and
inferred form value type, while reactive values read by the function update
the same form instance when they change.
Call this during component initialization. The form mounts with the component and is cleaned up when the component unmounts.
Example#
const form = createForm(() => ({
defaultValues: { name: '' },
onSubmit: ({ value }) => saveProfile(value),
}))
Returns#
The Svelte form API with typed field, subscription, and form-group components attached.