Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-multi-select-component

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-multi-select-component

Simple and lightweight multiple selection dropdown component with checkboxes, search and select-all

  • 4.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-multi-select-component

Simple and lightweight multiple selection dropdown component with checkboxes, search and select-all

Storybook GitHub Actions Status NPM gzip

✨ Features

  • 🕶 Zero Dependency
  • 🍃 Lightweight (<5KB)
  • 💅 Themeable
  • ✌ Written w/ TypeScript

🔧 Installation

npm i react-multi-select-component    # npm
yarn add react-multi-select-component # yarn

📦 Example

Example

import React, { useState } from "react";
import { MultiSelect } from "react-multi-select-component";

const options = [
  { label: "Grapes 🍇", value: "grapes" },
  { label: "Mango 🥭", value: "mango" },
  { label: "Strawberry 🍓", value: "strawberry", disabled: true },
];

const Example = () => {
  const [selected, setSelected] = useState([]);

  return (
    <div>
      <h1>Select Fruits</h1>
      <pre>{JSON.stringify(selected)}</pre>
      <MultiSelect
        options={options}
        value={selected}
        onChange={setSelected}
        labelledBy="Select"
      />
    </div>
  );
};

export default Example;

More examples can be found here ↗

👀 Props

PropDescriptionTypeDefault
labelledByvalue for aria-labelledbystring
optionsoptions for dropdown[{label, value, disabled}]
valuepre-selected rows[{label, value}][]
hasSelectAlltoggle 'Select All' optionbooleantrue
isLoadingshow spinner on selectbooleanfalse
shouldToggleOnHovertoggle dropdown on hover optionbooleanfalse
overrideStringslocalization ↗object
onChangeonChange callbackfunction
disableddisable dropdownbooleanfalse
disableSearchhide search textboxbooleanfalse
filterOptionscustom filter options (async supported) ↗functionFuzzy Search
classNameclass name for parent componentstringmulti-select
valueRenderercustom dropdown header ↗function
ItemRenderercustom dropdown option ↗function
ClearIconCustom Clear Icon for SearchReactNode
ArrowRendererCustom Arrow Icon for DropdownReactNode
debounceDurationdebounce duration for Searchnumber300
ClearSelectedIconCustom Clear Icon for Selected Items (Hint: Pass null to prevent it from rendering completely)ReactNode
isCreatableAllows user to create unavailable option(s) example ↗booleanfalse
onCreateOptionallows to override newly created option example ↗function
closeOnChangedValueautomatically closes dropdown when its value is changedbooleanfalse

📝 Changelog

For every release changelog/migration-guide will be available in releases

🤠 Credits

📜 License

MIT © harshzalavadiya

Keywords

FAQs

Package last updated on 07 Oct 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc