Skip to documentation
UI

Select

Base UI-powered Select component.

import { Select } from '@lobehub/ui/base-ui';
Data Entry

Default

Loading preview

Clear Value Contract

Loading preview
Loading preview

Tags with Closed Popup

Loading preview

Atom Components

Loading preview

Custom Render

Loading preview

Selected Indicator Variant

Loading preview

Virtual List

Loading preview

Viewport Bounds

The popup is clamped to the space base-ui reports as available, so the search field never leaves the viewport. setFloatingCollisionPadding reserves extra space on any side for every base-ui floating layer; here it keeps the popup below a fixed title bar.

APIs

Select

Select properties
allowClear
boolean
autoFocus
boolean
behaviorVariant
'default' | 'item-aligned'

Behavior variant for Base UI Select. - `default`: regular dropdown positioning (alignItemWithTrigger=false, modal=false) - `item-aligned`: aligns the selected item with trigger and uses modal=true

Defaults to "default".

className
string
classNames
SelectClassNames
defaultOpen
boolean
defaultValue
any
disabled
boolean
id
string
labelRender
(option: SelectOption<any>) => ReactNode
listHeight
number

设置弹窗滚动高度

Defaults to 512.

listItemHeightVirtualListProps
number

Row height hint for the virtualizer; rows are still measured after mount.

loading
boolean
mode
'multiple' | 'tags'
name
string
onChange
(value: any, option?: SelectOption<any> | SelectOption<any>[] | undefined) => void
onOpenChange
(open: boolean, eventDetails?: SelectRootChangeEventDetails) => void
onSelect
(value: any, option?: SelectOption<any> | undefined) => void
open
boolean
optionRender
(option: SelectOption<any>, info: { index: number; }) => ReactNode
options
SelectOptions<any>
placeholder
null | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
popupClassName
string
popupMatchSelectWidth
number | false | true
prefix
null | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | LucideIcon | FC<any>
readOnly
boolean
required
boolean
selectedIndicatorVariant
'bold' | 'check'

Variant for how selected items are indicated in the popup. - `check`: Display a checkmark icon next to selected items (default) - `bold`: Display selected items with bold text, no checkmark

Defaults to "check".

shadow
boolean
showSearch
boolean
size
'small' | 'middle' | 'large'

Defaults to "middle".

style
CSSProperties
suffixIcon
null | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | LucideIcon | FC<any>
suffixIconProps
Omit<IconProps, 'icon'>
tokenSeparators
string[]
value
any
variant
'outlined' | 'borderless' | 'filled'
virtualVirtualListProps
boolean

Only mount the rows near the scroll position. Use for long flat lists (hundreds of rows); groups and submenus keep working but are kept mounted as one row.

Defaults to false.

SelectOption

PropertyDescriptionTypeDefault
classNameThe className of optionstring-
disabledWhether disabledboolean-
labelDisplay text of optionReactNode-
styleCSS style of optionCSSProperties-
titleTitle attribute for optionstring-
valueValue of optionValue-

SelectOptionGroup

PropertyDescriptionTypeDefault
disabledWhether disabledboolean-
labelDisplay text of groupReactNode-
optionsOptions in this groupSelectOption[]-

SelectClassNames

PropertyDescription
clearClear button
dropdownDropdown container (alias for popup)
emptyEmpty state
groupOption group
groupLabelGroup label
iconSuffix icon
itemOption item
itemIndicatorSelected indicator
itemTextOption text
listOptions list
optionOption item (alias for item)
popupPopup container
prefixPrefix element
rootRoot container (alias for trigger)
searchSearch input container
suffixSuffix container
triggerTrigger element
valueValue display