SelectInput
A control that allows the user to browse, search, and make a selection from a large list of values.Prop | Required | Description | Type |
|---|---|---|---|
items | β
| Array of items for the user to select from. | (Item | GroupBase<Item>)[] | Promise<(Item | GroupBase<Item>)[]> |
dangerouslyIgnoreLastPass | β | Adds data-lpignore to the SelectInput's <input /> element, to prevent LastPass from inserting an icon that currently renders weirdly due to the way the react-select is built. Use only if confident that users won't use LastPass with this particular form field. @link https://support.lastpass.com/help/how-do-i-prevent-fields-from-being-filled-automatically | boolean |
invalid | β | The current validity state of the input. | boolean |
isClearable | β | Whether the select value is clearable. | boolean |
menuOverride | β | Render a custom Menu component. | (props: MenuProps<Item, boolean, GroupBase<Item>>) => Element |
menuPlacement | β | Where to render the menu in relation to the input. Defaults to auto. | "auto" | "bottom" | "top" |
name | β | Name for label and form usage. | string |
required | β | Marks the select as required. | boolean |
size | β | The size of the input. Defaults to medium. | "small" | "medium" |
hideDropdownIndicator | β | Hide the dropdown indicator (chevron down icon) inside the input. | boolean |
icon | β | Puts the provided Icon component in the input. | ComponentClass<IconProps, any> | FunctionComponent<IconProps> |
filterOption | β | Custom filter logic. @see https://react-select.com/advanced#custom-filter-logic | (option: FilterOptionOption<unknown>, inputValue: string) => boolean |
isCreatable | β | Whether to allow creation of new options along with choosing existing options. | boolean |
isValidNewOption | β | Whether the creatable option should be displayed based on the current input value, select value and options. | (inputValue: string, value: Options<Item>, options: OptionsOrGroups<Item, GroupBase<Item>>, accessors: Accessors<Item>) => boolean |
disabled | β | Disables the input. | boolean |
getOptionLabel | β | Resolves option data to a string to be displayed as the label by components. | GetOptionLabel<Item> |
getOptionValue | β | Resolves option data to a string to compare options and specify value attributes. | GetOptionValue<Item> |
inputValue | β | The value of the input. | string |
isLoading | β | When true, shows a loading indicator in the dropdown instead of results. Use if awaiting async items before passing to component. | boolean |
itemOverride | β | Render items in the menu with a custom component. | (props: OptionProps<Item, boolean, GroupBase<Item>>) => Element |
itemOverrideCheckIcon | β | Display CheckIcon on selected item(s) when using itemOverride (CustomOption). | boolean |
onInputChange | β | Called whenever the input value changes. Use to filter the items. | (inputValue: string, actionMeta: InputActionMeta) => void |
onBlur | β | Called when the select input is blurred. | FocusEventHandler<HTMLInputElement> |
onFocus | β | Called when the select input is focused. | FocusEventHandler<HTMLInputElement> |
placeholder | β | The text that appears in the form control when it has no value set. | string |
value | β | The selected item. | Item | Item[] |
isMulti | β | Whether the select value is multi-selectable. | boolean |
onChangeMulti | β | Called when an item is selected. Use in conjunction with isMulti. | (value: Item[]) => void |
limit | β | Limit the items to be displayed when multi-selectable. | number |
onChange | β | Called when an item is selected. | (value: Item) => void |
ref | β | (instance: SelectInstance<Item>) => void | MutableRefObject<SelectInstance<Item>> |