No reviews yetBe the first to leave a review for form-dirty
Wispr Flow: Dictation That Works Everywhere β Stop typing. Start speaking. 4x faster.
Stop typing. Start speaking. 4x faster.
Promoted
Maker
π
I built form-dirty because I kept copy-pasting the same "unsaved changes" logic across projects β and seeing the same question on StackOverflow over and over again.
The problem is simple: you want to know if a form has changed, which fields changed, and you want to warn users before they accidentally navigate away. But there was never a standalone solution for just that.
Full form libraries like react-hook-form handle dirty detection internally, but you have to buy into the entire system. If you're using vanilla JS, Vue, Svelte, or just want something lightweight alongside your existing setup β you were on your own.
form-dirty is the missing utility:
isDirty β one boolean, always up to date
changedFields β exactly which fields changed, with original + current values
beforeUnload: true β one option for the browser's "leave page?" guard
snapshot() β re-baseline after save
It works with native DOM forms (pass a selector, it handles inputs/checkboxes/radios/selects automatically) and with controlled state in any framework (pass an object, call update() when state changes).
~1.0kB gzipped. Zero dependencies. TypeScript with full type definitions. SSR safe.
The live demo on the landing page is fully interactive if you want to see it in action before installing.
Would love to hear: how are you currently handling dirty detection in your projects? Anything you'd want added?