-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make form components uncontrollable (#1683)
* implement uncontrolled form components A few versions ago we introduced compatibility with the native `form` element. This means that behind the scenes we render hidden inputs that are kept in sync which allows you to submit your normal form and get data via `new FormData(event.currentTarget)`. Before this change every form related component (Switch, RadioGroup, Listbox and Combobox) always had to be passed a `value` and an `onChange` regardless of this change. This change will allow you to not even use the `value` and the `onChange` at all and keep it completely uncontrolled. This has some changes: - `value` is made optional - `onChange` is made optional (but will still be called if passed regardless of being controlled or uncontrolled) - `defaultValue` got added so that you can still pre-fill your values with known values. - `value` render prop got exposed so that you can still use this while rendering. This should also make it completely compatible with tools like Remix without wiring up your own state. * update example combinations/form playground to use uncontrolled components * improve types, add missing render prop arguments * add tests for uncontrolled components (React) * implement uncontrolled form elements in Vue
- Loading branch information
1 parent
5bfa3da
commit 1831832
Showing
19 changed files
with
1,292 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.