[FormControl] Integrate FormControl with input components #17
Labels
component: form
This is the name of the generic UI component, not the React module!
enhancement
This is not a bug, nor a new feature
Motivation
To be able to easily compose different kinds of (higher level) form fields with consistent interaction states using Base components/hooks,
Currently, only the
Input
component is supported (doc).But that
<Input />
could just as well be anAutocomplete
or aSwitch
.Requirements
1. Consistent interface for getting a value from any form component
onChange
prop that gets anevent
as the sole argumentevent.target.value
, but doesn't work for cases like multi-select or Autocomplete with multiple optionsonChange: (event: React.SyntheticEvent, newValue: any) => void
Some components already have this second argument:
onChange?: (event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void
onChange?: (event: Event, value: number | number[], activeThumb: number) => void
onChange?: ( event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | null, value: SelectValue<OptionValue, Multiple>, ) => void
2. Additional metadata
Some components call onChange with "metadata" arguments:
reason
,details
activeThumb
Perhaps a general metadata object can be used as the third argument, e.g.
onChange: (event, newValue, metadata)
.Components
The text was updated successfully, but these errors were encountered: