Leave Yamada UI a star

Star
Yamada UIYamada UIv1.5.1

Select

Select is a component used for allowing a user to choose one option from a list.

Source@yamada-ui/select

Props

SelectProps

boundary

Description

The boundary area for the popper. Used within the preventOverflow modifier.

Type

HTMLElement | "clippingParents" | "scrollParent"

Default

'clippingParents'

closeOnBlur

Description

If true, the popover will close when you blur out it by clicking outside or tabbing out.

Type

boolean

Default

true

closeOnEsc

Description

If true, the popover will close when you hit the Esc key.

Type

boolean

Default

true

closeOnSelect

Description

If true, the list element will be closed when value is selected.

Type

boolean

Default

true

colorScheme

Description

The visual color appearance of the component.

Type

"whiteAlpha" | "blackAlpha" | "gray" | "neutral" | "red" | "rose" | "pink" | "flashy" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia"

containerProps

Description

Props for select container element.

Type

Omit<HTMLUIProps<"div">, "children">

defaultIsOpen

Description

If true, the popover will be initially opened.

Type

boolean

defaultValue

Description

The initial value of the select.

Type

string

duration

Description

The animation duration.

Type

number | Partial<Record<"enter" | "exit", number>>

errorBorderColor

Description

The border color when the input is invalid.

Type

string

eventListeners

Description

If provided, determines whether the popper will reposition itself on scroll and resize of the window.

Type

type ONLY_FOR_FORMAT = | boolean | { scroll?: boolean | undefined; resize?: boolean | undefined }

Default

true

flip

Description

If true, the popper will change its placement and flip when it's about to overflow its boundary area.

Type

boolean

Default

true

focusBorderColor

Description

The border color when the input is focused.

Type

string

gutter

Description

The distance or margin between the reference and popper. It is used internally to create an offset modifier.

Type

UIValue<number>

Default

8

iconProps

Description

Props for select icon element.

Type

SelectIconProps

isDisabled

Description

If true, the form control will be disabled.

Type

boolean

Default

false

isInvalid

Description

If true, the form control will be invalid.

Type

boolean

Default

false

isLazy

Description

If true, the PopoverContent rendering will be deferred until the popover is open.

Type

boolean

Default

false

isOpen

Description

If true, the popover will be opened.

Type

boolean

isReadOnly

Description

If true, the form control will be readonly.

Type

boolean

Default

false

isRequired

Description

If true, the form control will be required.

Type

boolean

Default

false

items

Description

If provided, generate options based on items.

Type

SelectItem[]

Default

'[]'

lazyBehavior

Description

The lazy behavior of popover's content when not visible. Only works when isLazy={true} - unmount: The popover's content is always unmounted when not open. - keepMounted: The popover's content initially unmounted, but stays mounted when popover is open.

Type

LazyMode

Default

'unmount'

listProps

Description

Props for select list element.

Type

Omit<SelectListProps, "children">

matchWidth

Description

If true, the popper will match the width of the reference at all times. It's useful for autocomplete, date-picker and select patterns.

Type

boolean

Default

false

modifiers

Description

Array of popper.js modifiers. Check the docs to see the list of possible modifiers you can pass.

Type

Partial<Modifier<string, any>>[]

Docs

https://popper.js.org/docs/v2/modifiers/

name

Description

The HTML name attribute used for forms.

Type

string

offset

Description

The main and cross-axis offset to displace popper element from its reference element.

Type

[number, number]

onChange

Description

The callback invoked when value state changes.

Type

(value: string) => void

onClose

Description

Callback fired when the popover closes.

Type

() => void

onOpen

Description

Callback fired when the popover opens.

Type

() => void

optionProps

Description

Props for select option element.

Type

Omit<OptionProps, "children" | "value">

placeholder

Description

The placeholder of the select.

Type

string

placeholderInOptions

Description

If true, include placeholders in options.

Type

boolean

Default

true

placement

Description

The placement of the popper relative to its reference.

Type

UIValue<Placement>

Default

'bottom'

portalProps

Description

Props to be forwarded to the portal component.

Type

Omit<PortalProps, "children">

Default

'{ isDisabled: true }'

preventOverflow

Description

If true, will prevent the popper from being cut off and ensure it's visible within the boundary area.

Type

boolean

Default

true

relatedRef

Description

The ref of the element related to the popover. This is used during the onBlur event.

Type

RefObject<HTMLElement>

size

Description

The size of the Select.

Type

"xs" | "sm" | "md" | "lg"

Default

md

strategy

Description

The CSS positioning strategy to use.

Type

"fixed" | "absolute"

Default

'absolute'

value

Description

The value of the select.

Type

string

variant

Description

The variant of the Select.

Type

"outline" | "filled" | "flushed" | "unstyled"

Default

outline

OptionGroupProps

label

Required

Description

The label of the option group.

Type

string

OptionProps

closeOnSelect

Description

If true, the list element will be closed when selected.

Type

boolean

Default

false

icon

Type

ReactElement<any, string | JSXElementConstructor<any>>

isDisabled

Description

If true, the select option will be disabled.

Type

boolean

Default

false

isFocusable

Description

If true, the select option will be focusable.

Type

boolean

Default

false

value

Description

The value of the select option.

Type

string

Edit this page on GitHub

PreviousToggleNextMultiSelect