Autocomplete
Decorate inputs with other elements to create a single field
BetaQuick nav
Features
- Keyboard accessible
- Composable and full control over options
- Themes ready
Anatomy
import { Autocomplete } from "@wonderflow/react-components";
export default () => {
return (
<Autocomplete>
<Autocomplete.Option value="1">Option 1</Autocomplete.Option>
<Autocomplete.Option value="2">Option 2</Autocomplete.Option>
<Autocomplete.Option value="3">Option 3</Autocomplete.Option>
</Autocomplete>
);
};API Reference
Autocomplete
This component extends all the properties from Textfield and adds the following ones:
Property
Type
Default
onChangefunctionmaxHeightstring200pxemptyContentReactNodeNo results foundbusybooleanfalseAutocomplete.Option
This component extends all the properties from Menu.Item and adds the following ones:
Property
Type
Default
value*stringonClickfunctionchildren*enumAccessibility
Keyboard interactions
tab
If the field is focused, move the focus on the listbox, otherwise move the focus on the field.
arrowDown
Inside the listbox, moves focus on the next element
arrowUp
Inside the listbox, moves focus on the previous element
Enter
Pick the option selected in the listbox.