0.3.4 • Published 6 years ago

rc-multi-level-selector v0.3.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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.

keytypedefault valuedescription
className?string''Apply a className to the control
selectorClassName?string''Apply classNames to Selector elements
optionsobject[] | 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 | objectNativeSelectorUse a custom selector component
getOptionsKey?function(option, value, index) => (value + '-' + index)Get keys to help React identify which items have changed
autoSelect?booltrueAutomatically 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

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.3.0-alpha.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago