1.2.2 • Published 2 years ago

@codinglane/dropdown v1.2.2

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

Contributors Forks Stargazers Issues MIT License

About The Project

There are many ways to create a dropdown for react. Personally I was not satisfied with either of them, so I decided to create my own, easy to use dropdown component for react.

Getting Started

All you have to do to use the package is to install it.

  • npm
    npm install @codinglane/dropdown

Usage

There are many use cases possible.

If you want to see the different use cases, run npm start inside the dropdown package.

For further information, go to the Properties section

Properties

PropTypeDefaultDescription
idstringundefinedThe current id of the dropdown
valueTundefinedThe current chosen value for the dropdown, typeof string. The value is not getting managed inside the component. You have to provide a function to manage the current chosen value.
searchablebooleanfalseSet this value to true, if you want to have a dropdown with an input field to search for an specific option.
classNamestringundefinedSet the classname of the dropdown, if you want to set your custom style.
closeOnSelectbooleanfalseSet this value to true, if you want that the options menu is getting closed as soon as an option is clicked.
fieldsArray<DropdownOptions> or <GroupedDropdownOptions>[]These are the possible options for the dropdown. If you want to have grouped dropdown options, set the type of the fields to GroupedDropdownOptions and set the group tag for all of them.
placeholderstringundefinedThe placeholder for the dropdown field. When the placeholder is set and the value is undefined or not assignable to any field, the placeholder is getting showed.
onChangeFunction()=>voidThe function to manage the current chosen value for the dropdown.
onBlurFunctionundefinedThis function is getting called on blur of the options menu.
onFocusFunctionundefinedThis function is getting called on focus of the options menu.
onFavorizeOptionFunctionundefinedThe onFavorizeOption is getting called as soon as the favorize icon in the option menu is getting clicked for an option. This dropdown do not manage the favorites on its own. You have to manage the favorizes to see changes in the component.
favoriteLabelsFavoriteLabelsundefinedThe labels for the favorite and non favorite group.
styleDropdownStyleSheetundefinedCustom stylesheet for the dropdown. It is possible to set the bg color, the color (for text & border), the font size and the font family.
data-testidstringundefinedFor testing purpose.

Types

DropdownOptions

NameType
valuestring
labelstring
favoriteboolean

GroupedDropdownOptions

NameType
valuestring
labelstring
favoriteboolean
groupstring

FavoriteLabels

NameType
favoritestring
nonFavoritestring

DropdownStyleSheet

NameTypeDescription
dropdownBackgroundColorstring
colorstringThe color is getting used for the text and the border bottom
dropdownFontSizestring
dropdownFontFamilystring

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Contributions are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Project Link: https://github.com/CodingLane/dropdown

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago