rc-multi-level-selector
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

RC-multi-level-selector Logo

npm rc-multi-level-selector JavaScript Style Guide GitHub license

React components that focus on handling multiple selector cascading relationships

Documentation

https://shianqi.github.io/rc-multi-level-selector/

Installation

Install rc-multi-level-selector as a dependency

# Yarn 
$ yarn add rc-multi-level-selector
 
# NPM 
$ npm install --save rc-multi-level-selector

Props

These are all of the available props (and their default values) for the main <MultiLevelSelector /> component.

key type default value description
className? string '' Apply a className to the control
selectorClassName? string '' Apply classNames to Selector elements
options object[] | object [] Specify the options the user can select from
values? string[] [] Control the current values
defaultValues? string[] [] The initial value passed to the uncontrolled component
onChange? function () => {} Subscribe to change events
optionFormat? function (option) => (option) Custom subcomponent options
Selector? function | object NativeSelector Use a custom selector component
getOptionsKey? function (option, value, index) => (value + '-' + index) Get keys to help React identify which items have changed
autoSelect? bool true Automatically select optional options
nullOption? object {id: 'NULL', value: 'NULL', display: true} If autoSelect is false, selected empty object

Example

import MultiLevelSelector from 'rc-multi-level-selector'
 
const options = [
  {
    id: 'China', value: 'China',
    items: [
      {
        id: 'Guangdong', value: 'Guangdong',
        items: [
          { id: 'Guangzhou', value: 'Guangzhou' },
          { id: 'Shenzhen', value: 'Shenzhen' }
        ]
      },
      { id: 'Beijing', value: 'Beijing', text: 'China - Beijing' }
    ]
  },
  {
    id: 'United States', value: 'United States',
    items: [{ id: 'California', value: 'California' }]
  }
]
 
...
<MultiLevelSelector
  options={options}
/>
...
 

Try it on CodeSandbox

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.3.43latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.43
0.3.31
0.3.21
0.3.11
0.3.01
0.3.0-alpha.01
0.2.31
0.2.21
0.2.11
0.2.01
0.1.41
0.1.31
0.1.21
0.1.11
0.1.01
0.0.151
0.0.141
0.0.131
0.0.121
0.0.111
0.0.101
0.0.91
0.0.81
0.0.71
0.0.61
0.0.51
0.0.41
0.0.31
0.0.21

Package Sidebar

Install

npm i rc-multi-level-selector

Weekly Downloads

31

Version

0.3.4

License

MIT

Unpacked Size

32.5 kB

Total Files

15

Last publish

Collaborators

  • shianqi