Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lightweight (~5KB gzipped) multiple selection dropdown component

License

NotificationsYou must be signed in to change notification settings

hc-oss/react-multi-select-component

Repository files navigation

Simple and lightweight multiple selection dropdown component withcheckboxes,search andselect-all

StorybookGitHub Actions StatusNPMgzip

✨ Features

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

🔧 Installation

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

📦 Example

Example

importReact,{useState}from"react";import{MultiSelect}from"react-multi-select-component";constoptions=[{label:"Grapes 🍇",value:"grapes"},{label:"Mango 🥭",value:"mango"},{label:"Strawberry 🍓",value:"strawberry",disabled:true},];constExample=()=>{const[selected,setSelected]=useState([]);return(<div><h1>Select Fruits</h1><pre>{JSON.stringify(selected)}</pre><MultiSelectoptions={options}value={selected}onChange={setSelected}labelledBy="Select"/></div>);};exportdefaultExample;

More examples can be foundhere ↗

👀 Props

PropDescriptionTypeDefault
labelledByvalue foraria-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: Passnull to prevent it from rendering completely)ReactNode
isCreatableAllows user to create unavailable option(s)example ↗booleanfalse
onCreateOptionallows to override newly created optionexample ↗function
closeOnChangedValueautomatically closes dropdown when its value is changedbooleanfalse

📝 Changelog

For every release changelog/migration-guide will be available inreleases

🤠 Credits

📜 License

MIT ©harshzalavadiya


[8]ページ先頭

©2009-2025 Movatter.jp