Form Reset
Keeps custom controls aligned with native form reset semantics without reporting uncontrolled resets as user changes.
Installation
dgadd ships in @diffgazer/add on npm: pnpm add -D @diffgazer/add puts it on pnpm exec, and npx @diffgazer/add runs it without the install.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS from the installed package.
Parameters
Returns
Examples
Resettable Input
Notes
Uncontrolled custom controls
Pair this hook with useControllableState's resetValue setter. It restores the default internal value without calling the public onChange callback.
Latest reset value
The reset listener stays stable while reading the latest resetValue and onReset callback.
Last mutation wins
Call the returned invalidation function immediately before changing the control value so an older queued reset cannot overwrite the newer mutation.
Source
Highlighted source loads after this disclosure opens. Browse the source repository.