Socket
Socket
Sign inDemoInstall

rc-select

Package Overview
Dependencies
Maintainers
2
Versions
463
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-select


Version published
Weekly downloads
1.3M
increased by0.39%
Maintainers
2
Install size
130 kB
Created
Weekly downloads
 

Package description

What is rc-select?

The rc-select npm package is a React component that provides a customizable select box or dropdown list. It supports various functionalities such as searching, multiple selection, custom rendering, and more, making it a versatile choice for implementing select inputs in web applications.

What are rc-select's main functionalities?

Basic Select

This code sample demonstrates how to create a basic select dropdown with predefined options. Users can select one of the options from the dropdown.

import Select from 'rc-select';

<Select placeholder="Please select">
  <Select.Option value="option1">Option 1</Select.Option>
  <Select.Option value="option2">Option 2</Select.Option>
</Select>

Multiple Selection

This example shows how to enable multiple selections, allowing users to select more than one option from the dropdown.

import Select from 'rc-select';

<Select mode="multiple" placeholder="Please select">
  <Select.Option value="option1">Option 1</Select.Option>
  <Select.Option value="option2">Option 2</Select.Option>
</Select>

Searchable Select

This code snippet enables a search functionality within the select dropdown, making it easier for users to find and select options by typing.

import Select from 'rc-select';

<Select showSearch placeholder="Search to select">
  <Select.Option value="option1">Option 1</Select.Option>
  <Select.Option value="option2">Option 2</Select.Option>
</Select>

Custom Dropdown Render

This example demonstrates how to customize the rendering of the dropdown menu, allowing for additional elements like a custom footer to be added.

import Select from 'rc-select';

<Select dropdownRender={menu => (
  <div>
    {menu}
    <div style={{ padding: '8px', cursor: 'pointer' }}>Custom footer</div>
  </div>
)}>
  <Select.Option value="option1">Option 1</Select.Option>
  <Select.Option value="option2">Option 2</Select.Option>
</Select>

Other packages similar to rc-select

Readme

Source

rc-select


React Select

NPM version SPM version build status Test coverage gemnasium deps node version npm download Sauce Test Status

Sauce Test Status

Screenshots

Feature

  • support ie8,ie8+,chrome,firefox,safari

Keyboard

  • Open select (focus input || focus and click)
  • KeyDown/KeyUp/Enter to navigate menu

install

rc-select

Usage

basic use

var React = require('react'); 
var Select = require('../');
var Option = Select.Option;

var c = (
  <Select>
    <Option value="jack">jack</Option>
    <Option value="lucy">lucy</Option>
    <Option value="jim">jim</Option>
  </Select>
);
React.render(c, container);

API

Select props

nametypedefaultdescription
classNameStringadditional css class of root dom node
filterOptiontrue|Function(inputValue:string, option:Option)whether filter options by input value. default filter by option's optionFilterProp prop's value
optionLabelPropStringvaluewhich prop value of option will render as content of select
optionFilterPropStringvaluewhich prop value of option will be used for filter if filterOption is true
showSearchBooleantruewhether show search input in single mode
onSearchFunctioncalled when input changed
disabledBooleanfalsewhether disabled select
animationStringdropdown animation name. only support slide-up now
transitionNameStringdropdown css animation name
valueString | Arrayspecify the selected option(s)
defaultValueString | Arrayspecify the default selected option(s)
multiplefalsecan select more than one option
tagsfalsewhen tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far.
allowClearfalse
comboboxfalseenable combobox mode(can not set multiple at the same time)
onSelectFunction(value:string, option:Option)called when a option is selected. param is option's value and option instance
onDeselectFunctioncalled when a option is deselected. param is option's value. only called for multiple or tags
onChangefunction(value)called when select an option or input value change(combobox)

Option props

nametypedefaultdescription
disabledBooleanfalseno effect for click or keydown for this item
valueStringsearch by this attribute

OptGroup props

nametypedefaultdescription
labelString|React.Elementgroup label
keyString

Development

npm install
npm start

Example

http://localhost:8003/examples/

online example: http://react-component.github.io/select/examples/

Test Case

http://localhost:8003/tests/runner.html?coverage

Coverage

http://localhost:8003/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8003/tests/runner.html?coverage

License

rc-select is released under the MIT license.

Keywords

FAQs

Last updated on 23 Jun 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc