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-multiselect-dropdown-bootstrap

v1.1.0

Published

A dropdown solution that can handle written in React.js. Styled with Boostrap 4.

Downloads

4,063

Readme

react-multiselect-dropdown-bootstrap

A React.js component to easy create dropdowns that allows multiple option selection.

Examples

Here is an example with default settings when only an array with options is provided:

Default settings

How to install

npm install react-multiselect-dropdown-bootstrap

Then you need to import it and place somewere in your app. Here is an example for default setup:

import React from "react";
import DropdownMultiselect from "react-multiselect-dropdown-bootstrap";

class SomeSection extends React.Component {
  render() {
    return (
      <DropdownMultiselect
        options={["Australia", "Canada", "USA", "Poland", "Spain", "France"]}
        name="countries"
      />
    );
  }
}

export default SomeSection;

You can also use an options with different values than labels. Please check an example below:

import React from "react";
import DropdownMultiselect from "react-multiselect-dropdown-bootstrap";

class SomeSection extends React.Component {
  render() {
    const optionsArray = [
      { key: "au", label: "Australia" },
      { key: "ca", label: "Canada" },
      { key: "us", label: "USA" },
      { key: "pl", label: "Poland" },
      { key: "es", label: "Spain" },
      { key: "fr", label: "France" },
    ];

    return <DropdownMultiselect options={optionsArray} name="countries" />;
  }
}

export default SomeSection;

Available props

Required

  • options - an array with available options. You can use a simple array like ["Spain", "Italy"] or array of objects like [{key: "es", label: "Spain"}, {key: "it", label: "Italy"}] to set a different values to select than labels that will be shown in a dropdown.
  • name - a string with the name (just like for normal html inputs)

Optional

  • selected - an array with options that should be selected as default
  • handleOnChange - a callback function to run when selected options will be changed. A "selected" param is available. It contains an array of currently selected options. Example:
handleOnChange={(selected) => {
  props.changeMarket(selected);
}}
  • placeholder - default value is "Nothing selected"
  • buttonClass - you can specify a css class for button. Default is "btn-light"
  • placeholderMultipleChecked - you can specify a placeholder that will be used if more than one option is selected at the same time. For example: "Multiple selected"
  • optionKey - specify custom key property of object. Default is "key"
  • optionLabel - specify custom label property of object. Default is "label"
  • selectDeselectLabel - specify custom label to use in select/deselect all button. Default is "Select/Deselect All"