🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@rc-component/select

Package Overview
Dependencies
Maintainers
5
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/select

React Select

Source
npmnpm
Version
1.9.1
Version published
Weekly downloads
1.1M
-4.29%
Maintainers
5
Weekly downloads
 
Created
Source

@rc-component/select

Ant Design Part of the Ant Design ecosystem.

🎯 Composable Select component for React, with search, async-friendly option data, custom rendering, and virtual scrolling.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

AreaSupport
Dataoptions data, legacy Option children, grouped options
ModesSingle select, multiple, tags, and combobox
SearchControlled search, custom filter, custom sort
RenderingCustom option, label, selected item, clear, and menu icons
ScaleVirtual scrolling with configurable item height

Install

npm install @rc-component/select

Usage

import Select from '@rc-component/select';
import '@rc-component/select/assets/index.css';

export default () => (
  <Select
    placeholder="Select a user"
    options={[
      { value: 'jack', label: 'Jack' },
      { value: 'lucy', label: 'Lucy' },
      { value: 'yiminghe', label: 'Yiminghe' },
    ]}
  />
);

Examples

Run the local dumi site:

npm install
npm start

Then open http://localhost:8000.

API

Select

Select also accepts public props from BaseSelect, except showSearch, which is redefined by Select.

NameDescriptionTypeDefault
autoClearSearchValueDeprecated. Use showSearch.autoClearSearchValue instead.booleantrue
backfillBackfill the active option into the input. Only works in combobox mode.booleanfalse
childrenLegacy option children. Prefer options for new code.ReactNode-
classNamesSemantic class names.Partial<Record<SemanticName, string>>-
defaultActiveFirstOptionWhether the first option is active by default.booleantrue
defaultValueInitial selected value.ValueType | null-
directionDropdown direction.ltr | rtlltr
fieldNamesCustomize option field names.FieldNames-
filterOptionDeprecated. Use showSearch.filterOption instead.boolean | FilterFunc<OptionType>-
filterSortDeprecated. Use showSearch.filterSort instead.(optionA, optionB, info) => number-
labelInValueReturn labeled value objects instead of raw values.booleanfalse
labelRenderCustom selected label render.(props: LabelInValueType) => ReactNode-
listHeightPopup list height.number200
listItemHeightPopup list item height.number20
maxCountMaximum selected item count.number-
menuItemSelectedIconCustom selected option icon.RenderNode-
modeSelect mode.combobox | multiple | tags-
onActiveCalled when the active value changes.(value: ValueType) => void-
onChangeCalled when selected value changes.(value: ValueType, option?: OptionType | OptionType[]) => void-
onDeselectCalled when a value is deselected.(value, option) => void-
onSearchDeprecated. Use showSearch.onSearch instead.(value: string) => void-
onSelectCalled when a value is selected.(value, option) => void-
optionFilterPropDeprecated. Use showSearch.optionFilterProp instead.string | string[]-
optionLabelPropOption prop used as the selected label.string-
optionRenderCustom option renderer.(oriOption, info: { index: number }) => ReactNode-
optionsOption data.OptionType[]-
searchValueDeprecated. Use showSearch.searchValue instead.string-
showSearchEnable search or configure search behavior.boolean | SearchConfig<OptionType>-
stylesSemantic styles.Partial<Record<SemanticName, CSSProperties>>-
valueControlled selected value.ValueType | null-
virtualDisable virtual scrolling when set to false.booleantrue

Methods

NameDescriptionParameters
blurRemove focus.-
focusFocus the selector.-

SearchConfig

NameDescriptionTypeDefault
autoClearSearchValueClear search input after selecting or deselecting in multiple mode.booleantrue
filterOptionFilter options by search input.boolean | FilterFunc<OptionType>-
filterSortSort filtered options.(optionA, optionB, info: { searchValue: string }) => number-
onSearchCalled when search input changes.(value: string) => void-
optionFilterPropOption prop used for filtering when filterOption is enabled.string | string[]-
searchValueControlled search input value.string-

Option

Option is a legacy placeholder component. Prefer the options prop for new usage.

NameDescriptionTypeDefault
childrenOption label.ReactNode-
classNameOption class name.string-
disabledDisable the option.booleanfalse
titleOption title.string-
valueOption value.string | number | null-

OptGroup

OptGroup is a legacy placeholder component. Prefer nested options data for new usage.

NameDescriptionTypeDefault
childrenGroup options.ReactNode-
classNameGroup class name.string-
disabledDisable the group.booleanfalse
labelGroup label.ReactNode-
titleGroup title.string-

Development

npm install
npm start
npm test
npm run lint
npm run tsc
npm run compile

The dumi site runs at http://localhost:8000 by default.

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command after the package build.

License

@rc-component/select is released under the MIT license.

Keywords

react

FAQs

Package last updated on 30 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts