1.0.6 • Published 8 years ago

react-single-dropdown v1.0.6

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

react-single-dropdown

Installation

npm install react-single-dropdown --save

Features

  • React single dropdown
  • You can pass options as array
  • Set a default selected option
  • Get the selected option

Usage

<ReactSingleDropdown 
    options={'Option 1', 'Option 2', 'Option 3'}
    defaultSelected='Option 2'/>

Props

<ReactSingleDropdown>

NameTypeDefaultDescription
optionsarray[]Specify the select(Dropdown) component options as an array of values. For example 'option 1', 'options 2', option 3'
defaultSelectedstringnullSpecify one option from the options array as default selected option if required.
noAnimationbooleantrueWhether or not dropdown arrow animation should be enabled.
widthnumber100%Width of the dropdown menu, in px. The default width of the component is 100% of the parent component's width. For example width='350'. This means that the width of the component is 350px.
onSelectfunctionselected valueThis is a call-back function which returns the selected value back on onSelect.

Example

import React from 'react'

import ReactSingleDropdown from 'react-single-dropdown'

export default class Demo extends React.Component {

  onDropdownSelect = (value) => {
    console.log('Selected value=', value)
  }
  
  render() {
    return <div>
      <h1>react-single-dropdown Demo</h1>
      <ReactSingleDropdown 
      defaultSelected = 'Option 3'
      onSelect={this.onDropdownSelect}
      noAnimation
      options={['Option 1','Option 2','Option 3']}
      width='500'/>
    </div>
  }
}

License

MIT

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago