0.0.2 • Published 7 years ago

rk-rc-select v0.0.2

Weekly downloads
2
License
-
Repository
github
Last release
7 years ago

rk-rc-select


rk-rc-select: https://github.com/RK-WJW/select, 在rc-select基础上做了些调整

  • 修改了依赖rc-menu,改为调整后的rk-rc-menu

React Select

NPM version build status Test coverage gemnasium deps npm download

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

import Select, {Option, OptGroup} from 'rc-select';

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

API

Select props

namedescriptiontypedefault
classNameadditional css class of root dom nodeString''
prefixClsprefix classString''
animationdropdown animation name. only support slide-up nowString''
transitionNamedropdown css animation nameString''
choiceTransitionNamecss animation name for selected items at multiple modeString''
dropdownMatchSelectWidthwhether dropdown's with is same with selectbooltrue
dropdownClassNameadditional className applied to dropdownString-
dropdownStyleadditional style applied to dropdownObject{}
dropdownAlignadditional align applied to dropdownObject{}
dropdownMenuStyleadditional style applied to dropdown menuObject{}
notFoundContentspecify content to show when no result matches.String'Not Found'
tokenSeparatorsseparator used to tokenize on tag/multiple modestring[]?
placeholderselect placeholderReact Node
showSearchwhether show search input in single modebooltrue
showArrowwhether show arrow in single modebooltrue
allowClearwhether allowClearboolfalse
tagswhen 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.boolfalse
maxTagTextLengthmax tag text length to shownumber-
comboboxenable combobox mode(can not set multiple at the same time)boolfalse
multiplewhether multiple selectboolfalse
disabledwhether disabled selectboolfalse
filterOptionwhether filter options by input value. default filter by option's optionFilterProp prop's valuebooltrue/Function(inputValue:string, option:Option)
optionFilterPropwhich prop value of option will be used for filter if filterOption is trueString'value'
optionLabelPropwhich prop value of option will render as content of selectString'value'
defaultValueinitial selected option(s)String/Array-
valuecurrent selected option(s)String/Array/{key:String, label:React.Node}/Array<{key, label}>-
labelInValuewhether to embed label in value, see above value typeBoolfalse
onChangecalled when select an option or input value change(combobox)function(value)-
onSearchcalled when input changedfunction-
onBlurcalled when blurfunction-
onFocuscalled when focusfunction-
onSelectcalled when a option is selected. param is option's value and option instanceFunction(value, option:Option)-
onDeselectcalled when a option is deselected. param is option's value. only called for multiple or tagsFunction(value)-
defaultActiveFirstOptionwhether active first option by defaultbooltrue
getPopupContainercontainer which popup select menu rendered intofunction(trigger:Node):Nodefunction(){return document.body;}

Option props

namedescriptiontypedefault
classNameadditional class to optionString''
disabledno effect for click or keydown for this itemboolfalse
keyif react want you to set key, then key is same as value, you can omit valueString-
valuedefault filter by this attribute. if react want you to set key, then key is same as value, you can omit valueString-
titleif you are not satisfied with auto-generated title which is show while hovering on selected value, you can customize it with this propertyString-

OptGroup props

namedescriptiontypedefault
labelgroup labelString/React.Element-
key-String-
valuedefault filter by this attribute. if react want you to set key, then key is same as value, you can omit valueString-

Development

npm install
npm start

Example

http://localhost:8003/examples/

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

Test Case

npm test

Coverage

npm run coverage

License

rc-select is released under the MIT license.