Socket
Socket
Sign inDemoInstall

react-multi-select-component

Package Overview
Dependencies
5
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

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


Version published
Maintainers
1
Weekly downloads
51,283
decreased by-15.13%

Weekly downloads

Readme

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

Last updated on 07 Oct 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc