Skip to content

Select

Displays a list of options for the user to pick from—triggered by a button. Replicates the core capabilities of the shadcn-vue Select component, supporting single selection, multiple selection, search, grouping, and other functions. Based on BrConfigProvider for global theme configuration.

Basic

The most basic single selection mode, supports custom placeholder.

Selected: apple
Example

Grouping

Display options in groups using the group field.

Example

Enable the filterable prop and listen to the search event to implement remote search. Supports loading state.

Current Value:
Example

Multiple Selection & Clearable

Enable the multiple prop to support multiple selection, and clearable for one-click clearing.

React
Vue
Selected: [ "react", "vue" ]
Example

Size

Supports default, sm, lg sizes.

Example

Status

Supports error state.

Example

Theming

The BrSelect component fully follows the theme specifications of BrConfigProvider.

Global Configuration & Local Override

  • Global Configuration: Configure global colors via the theme prop of BrConfigProvider, and the Select component will automatically adapt.
  • Local Override: You can use Tailwind CSS class names to directly override styles.

Default Theme

Custom Dark Theme (via ConfigProvider)

Example

API

Props

PropTypeDefaultDescription
modelValuestring | number | (string | number)[]-Binding value
options(string | number | SelectOption)[][]Options data
placeholderstring'Select an option'Placeholder
disabledbooleanfalseWhether disabled
clearablebooleanfalseWhether clearable
filterablebooleanfalseWhether searchable
multiplebooleanfalseWhether multiple selection
loadingbooleanfalseWhether loading (for remote search)
emptyTextstring'No options found.'Text to display when no options are found
size'default' | 'sm' | 'lg''default'Size
errorbooleanfalseWhether error state

SelectOption Type

ts
interface SelectOption {
  label: string
  value: string | number
  disabled?: boolean
  group?: string
}

Events

NameDescriptionPayload
update:modelValueEmitted when binding value changesvalue: string | number | (string | number)[]
changeEmitted when selected value changesvalue: string | number | (string | number)[]
clearEmitted when clear button is clicked-
searchEmitted when search input changesquery: string