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.40latest

Version History

VersionDownloads (Last 7 Days)Published
0.3.40
0.3.30
0.3.20
0.3.10
0.3.00
0.3.0-alpha.00
0.2.30
0.2.20
0.2.10
0.2.01
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.150
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.91
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20

Package Sidebar

Install

npm i rc-multi-level-selector

Weekly Downloads

1

Version

0.3.4

License

MIT

Unpacked Size

32.5 kB

Total Files

15

Last publish

Collaborators

  • shianqi