Reset an entire form
A user abandons edits and needs to restore every field to the configured initial values.
Conform · Pipe
form.reset is a Conform form intent for restoring the entire form or a specific field, including nested and list fields. Use its button-props helper to wire a reset control into the form.
form.reset exposes an intent for resetting the entire form or selected fields. Its getButtonProps helper serializes that intent onto a button, which Conform processes when the form is handled.
form.reset.getButtonProps(options?)An intent object whose getButtonProps method produces button props for resetting the form or a named field.
form.reset represents a reset intent that can apply to the complete form or to selected fields.getButtonProps() to create the props for a button that triggers the reset action.useInputControl are the exception; their value resets when the key changes.import { useForm } from '@conform-to/react';
export default function Example() {
const [form, fields] = useForm({
defaultValue: { email: '' },
});
return (
<form id={form.id}>
<input {...fields.email} />
<button type="button" {...form.reset.getButtonProps()}>
Reset form
</button>
</form>
);
}The button dispatches Conform’s reset intent, restoring the form to its configured default value.
A user abandons edits and needs to restore every field to the configured initial values.
A nested editor or dynamic list item needs an independent reset control.
A form displays custom inputs that must follow Conform’s reset lifecycle.
form.reset reset a form or field?form.reset is an intent helper returned by useForm. Calling getButtonProps() on it creates button props that reset the whole form, while providing a field name targets that field, including nested or list fields.
Follow-up: How can a reset target a non-default state? Use the current stable future useIntent API’s reset({ defaultValue }), passing null to clear fields or an object for a specific state.
The reset control is represented as a form intent rather than an ordinary browser-only reset. A field-specific reset supplies the field metadata name, allowing Conform to identify the targeted field.
Follow-up: What does the server-side resolver produce for a form intent? resolveSubmission returns the resolved intent and the target value produced by that intent.
Inputs should receive the key from field metadata. Conform uses that key to notify React that the input should remount with the updated initial value.
Follow-up: What is the controlled-input exception? useInputControl resets the controlled value when the key changes, instead of relying on an uncontrolled input remount.
useFormform.validateform.insertform.updateform.removeform.reorderuseInputControl