Adaptive Select
Adaptiveness
- Desktop: doesn't block interaction with other page elements when open
- Android & iOS: uses the native device select
- iOS: native styling
One
Variations
Variant
Standard
Outlined
Filled
Label
One
Multiple Values
One
Grouping
One
Native Limitations
- The
event.target.valuefor the nativeonChangeevent is always a string - The
optionelement browser support & React support for content other than text is currently limited MDN
No Selected Value
The first value is auto selected if there's no specified selected value on a native select.
To compensate for this the AdaptiveSelect adds a hidden option with a empty value, which can be removed
using the nativeEmptyValueOption prop if needed.
Default
Disabled
Disable Native
To disable the native select for all environments, native={false} can be added to the component or theme
One
API
MUI Select API with the following changes:
inputdefaults toAdaptiveInput,AdaptiveFilledInput, orAdaptiveOutlinedInput- Desktop:
MenuProps.disableScrollLockdefaults totrue - Desktop:
MenuProps.slots.rootdefaults toModalNonBlocking - Android & iOS:
nativedefaults totrue
nativeEmptyValueOption
Adds a hidden empty value option element when native
- Type:
boolean - Default:
true
AdaptiveSelectItem
MUI MenuItem API with the following changes:
- Props not applicable to a
<option>element are ignored on native. See the source for the full list of ignored props.
AdaptiveSelectItemGroup
MUI ListSubheader API with the following changes:
- Props not applicable to a
<optgroup>element are ignored on native. See the source for the full list of ignored props.
Links
- Component Source
- Doc Source adaptiveSelect.mdx
- MUI Select