npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-select-enhanced-counter

v0.0.2

Published

A React Select package with 'Select All' feature and a counter for displaying the number of selected items beyond a specified limit.

Downloads

10

Readme

React Select Enhanced Counter

npm version License: MIT

A React Select package with 'Select All' feature and a counter for displaying the number of selected items beyond a specified limit.

Installation

Install the package using npm:

npm install react-select-enhanced-counter

Install the package using yarn:

yarn add react-select-enhanced-counter

Live Example

You can see a live example of this package in action on the React Select Enhanced Counter Live Example.

Usage

Single Select Example

<Select
  options= {[
    { value: '1', key: 'Chocolate' },
    { value: '2', key: 'Strawberry' },
    { value: '3', key: 'Vanilla' },
    { value: '4', key: 'Banana' },
    { value: '5', key: 'Lemon' },
    { value: '6', key: 'Potato' },
  ]}
  defaultValue= {{ value: '1', key: 'Chocolate' }}
  displayExpr= {'key'}
  valueExpr= {'value'}
  isClearable= {true}
  noOptionsMessage= {'No options'}
  placeholder= {'Single Select'}
/>

Multi Select Example

<Select
  options= {[
    { value: '1', key: 'Chocolate' },
    { value: '2', key: 'Strawberry' },
    { value: '3', key: 'Vanilla' },
    { value: '4', key: 'Banana' },
    { value: '5', key: 'Lemon' },
    { value: '6', key: 'Potato' },
  ]}
  defaultValue= {[
    { value: '4', key: 'Banana' },
    { value: '5', key: 'Lemon' },
    { value: '6', key: 'Potato' },
  ]}
  displayExpr= {'key'}
  valueExpr= {'value'} 
  isMulti={ true}
  isClearable= {true}
  allowSelectAll= {true}
  numberDisplayed={2}
  placeholder= {'Multi Select'}
  selectAllText= {'Select All'}
  noOptionsMessage= {'No options'}
/>

Props

  • options* (Array): Array of possible options.
  • displayExpr* (string): Required if supplying an array of objects as options. Used to identify which property on the object is the label.
  • valueExpr* (string): Required if supplying an array of objects as options. Used to identify which property on the object is the value.
  • placeholder (string): Default message when no items are selected.
  • isMulti (boolean): Set to true for a multiselect, defaults to false.
  • className (string): Add custom class.
  • isDisabled (boolean): Is the select disabled.
  • onChangeSelect (event:any) => void: Called whenever selected value(s) have changed.
  • defaultValue (Array): It selects values by default.
  • isSearchable (boolean): If set to true, will add an input at the top of the dropdown for filtering the results.
  • allowSelectAll (boolean): If set to true, will add a Select All checkbox at the top of the list.
  • maxMenuHeight (number): The height of the dropdown. Defaults to 400px.
  • allSelectedPlaceholder (string): Default "%s selected" where %s is the number of items selected. This gets used when all options are selected.
  • selectAllText (string): Default "Select all", use this to override "Select all" text from top of dropdown when included with includeSelectAll.
  • numberDisplayed (number): The number of selected options displayed until it turns into '(selected count) selected'. Defaults to 4.
  • customStyles (StylesConfig<any, boolean, any>): Style modifier methods.
  • isLoading (boolean): Is the select in a state of loading (async).
  • isClearable (boolean): Is the select value clearable.
  • name (string): Name of the HTML Input (optional - without this, no input will be rendered).
  • noOptionsMessage (string): Text to display when there are no options to list.

Contributing

If you want to contribute to this project, feel free to open an issue or submit a pull request.

License

MIT