1.2.0 • Published 8 years ago

react-awesome-select v1.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

AWESOMESELECT

This is a select component, provide hot search, clean, show the number of items. It is simple to use. live demo

use

npm i --save react-awesome-select

And in you component

import { AwesomeSelect } from 'react-awesome-select';

class Select extends React.Component {
  contructor() {
    super();
    this.state = {
      data: [
        { name: `China`, value: 1, selected: true },
        { name: `Australia`, value: 2 },
        { name: `Austria`, value: 3 },
        { name: `Belgium`, value: 4 },
        { name: `Canada`, value: 5 },
        { name: `Denmark`, value: 6 },
        { name: `Ecuador`, value: 7 },
        { name: `Egypt`, value: 8 },
        { name: `Finland`, value: 9 },
        { name: `France`, value: 10 },
        { name: `Georgia`, value: 11 },
        { name: `Germany`, value: 12 },
        { name: `Greece`, value: 13 },
        { name: `Hungary`, value: 14 },
        { name: `Iceland`, value: 15 },
        { name: `India`, value: 16, selected: true },
        { name: `Iran`, value: 17, selected: true },
        { name: `Italy`, value: 18, selected: true }
      ]
    };
  }

  render() {
    return (
      <AwesomeSelect
        style={{ width: '400px' }}
        data={this.state.data}
        mult
        onChange={(value, name, allChoose) => console.log(`---`, value, name, allChoose)}
      />
    );
  }
}

Props

propstype
dataArray(isRequired)
multBool(default: false)
styleobject
onChangefunction(isRequired)
onBlurfunction

data

const data = [{
  name: 'Stephen.Kingsley',
  value: 1,
  selected: true
}];

mult is MultiSelect,default is false

style is the select style

onChange(value, name, allChoose)

value is the item of value you click

name is the item of name you click

when mult = true. allChoose is what you selected

paramstype
valuestring
namestring
allChooseobject

localhost demo

git clone https://github.com/stephenkingsley/react-select.git
cd react-select
npm install
npm start
1.2.0

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago