Socket
Socket
Sign inDemoInstall

react-single-dropdown

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-single-dropdown

Single select dropdown for react


Version published
Maintainers
1
Install size
346 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 26 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc