Skip to main content

Select

Select component to select value from options.

When To Use#

  • A dropdown menu for displaying choices - an elegant alternative to the native <select> element.
  • Utilizing Radio is recommended when there are fewer total options (less than 5).

Examples#

import { Select } from 'tailor-ui';

Basic#

other sizes#





Searchable#

Creatable#

disabled#

With placeholder & clearable#

Large items & custom menu#

Multiple#

API#

PropertyDescriptionTypeDefault
idId of selectstring
nameName of selectstring
classNameClassName of selectstring
widthWidth of selectstring | number240
sizeSelect size'sm' | 'md' | 'lg''md'
creatableCreate new option with input text if truebooleanfalse
clearableShow clear button.booleanfalse
disabledWhether disabled selectbooleanfalse
loadingIs the select in a state of loadingbooleanfalse
multipleSupport multiple selected optionsbooleanfalse
searchableWhether to enable search functionalitybooleanfalse
optionsThe options of selectOption[][]
valueCurrent selected optionOption | Option[]
defaultValueInitial selected optionOption | Option[]
placeholderPlaceholder of selectstring
menuRender additional menu after optionsReactNode
itemSizeSize of menu optionnumber36
optionsMaxHeightMaximum height of the menu before scrollingnumber180
onChangeCalled when select an option or input value change(option: Option \| Option[]) => void
onBlurCalled when blur(event: FocusEvent) => void
noOptionsMessageText to display when there are no options() => ReactNode
formatCreateLabelGets the label for the "create new option ..." option in the menu. Is given the current input value.(labelInfo: { value: string; active: boolean; hovered: boolean }) => ReactNodevalue => Create new option: ${value}
isValidNewOptionDetermines whether the "create new option ..." option should be displayed based on the current input value, select value and options array.(value: string) => booleanvalue => value.trim() !== ''
onCreateOptionIf provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created(value: string) => void