AutoComplete
Customized AutoComplete component from @mui/material/AutoComplete
Props
- options - (required) Array of options for the select
- label - (required) Label for the select
- control - (required) Control from react-hook-form
- name - (required) Name of the select
- sx - (not required) sx props from @mui/material
- fullWidth - (not required) if true then select will be full width
- loading - (not required) if true then loading will be shown
- multiple - (not required) if true then select will be multiple
- disableCloseOnSelect - (not required) if true then select will not close on select
- optionLabel - (not required) if provided then it will be used to display the label of the option
- renderOption - (not required) if provided then it will be used to render the option
Usage
import { AutoComplete } from 'react-componentry';
import { Control } from 'react-hook-form';
const App = () => {
const { control } = useForm();
return (
<AutoComplete
control={control}
name="name"
label="Name"
options={[
{ value: '1', label: 'One' },
{ value: '2', label: 'Two' },
{ value: '3', label: 'Three' },
]}
/>
);
};