0.2.2 • Published 5 years ago

react-popper-dropdown v0.2.2

Weekly downloads
81
License
MIT
Repository
github
Last release
5 years ago

React Popper Dropdown

npm version NPM license npm

This is a library made with React and React-Popper for creating a simple customizable dropdown.

React Popper Dropdown is written in functional programming style with ES2016 and Flow.

Installation

You can install the library with NPM:

npm install –-save react-popper-dropdown

or with YARN:

yarn add react-popper-dropdown

Usage

To use React Popper Dropdown, you have to import the library and its base types you intend to use, for example:

import ReactPopperDropdown from "react-popper-dropdown"

then you can use it inside your component. For example:

import React from 'react'
import ReactPopperDropdown from "react-popper-dropdown"

let choices = [
  {id:0, value:"choice 1"},
  {id:1, value:"choice 2"},
  {id:2, value:"choice 3"},
]

let value = choices[0]

class MyDropdown extends React.Component {

  render = () => <ReactPopperDropdown choices={choices} value={value} />

}

Component Props

The ReactPopperDropdown component accepts the following props:

PropDefaultDescription
choicesSpecifies the possibles value of dropdown
valueSpecifies the value of dropdown, could be an element or a list of element in case of a multi select
idGetter(element) => element.idSpecifies how to get the id of choice
labelGetter(element) => element.labelSpecifies how to get the label of choice
renderer(value) => valueSpecifies how to render the column value
enabledtrueAllows the user to change or the value
onValueChangeAllows to specify an event handler for the value change event
enableResettrueAllows to user to reset the value
filterabletrueShow the filter textbox that Allows to user to filter the choices
popperContainerdocument.bodyWhen the popper element is attached
classNameCss classes to apply to the component
autoWidthfalseEnable the automatically adjusts the width of the popup element
maxHeightautoDefines the max height of the dropdown popup
multifalseEnables multiple selection

Conclusion

Pull requests are welcome, enjoy your react popper dorpdown!

Contributors

This project exists thanks to all the people who contribute.

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago