Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork95
Lightweight (~5KB gzipped) multiple selection dropdown component
License
NotificationsYou must be signed in to change notification settings
hc-oss/react-multi-select-component
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Simple and lightweight multiple selection dropdown component withcheckboxes,search andselect-all
- 🕶 Zero Dependency
- 🍃 Lightweight (<5KB)
- 💅 Themeable
- ✌ Written w/ TypeScript
npm i react-multi-select-component# npmyarn add react-multi-select-component# yarn
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 ↗
| Prop | Description | Type | Default |
|---|---|---|---|
labelledBy | value foraria-labelledby | string | |
options | options for dropdown | [{label, value, disabled}] | |
value | pre-selected rows | [{label, value}] | [] |
hasSelectAll | toggle 'Select All' option | boolean | true |
isLoading | show spinner on select | boolean | false |
shouldToggleOnHover | toggle dropdown on hover option | boolean | false |
overrideStrings | localization ↗ | object | |
onChange | onChange callback | function | |
disabled | disable dropdown | boolean | false |
disableSearch | hide search textbox | boolean | false |
filterOptions | custom filter options (async supported) ↗ | function | Fuzzy Search |
className | class name for parent component | string | multi-select |
valueRenderer | custom dropdown header ↗ | function | |
ItemRenderer | custom dropdown option ↗ | function | |
ClearIcon | Custom Clear Icon for Search | ReactNode | |
ArrowRenderer | Custom Arrow Icon for Dropdown | ReactNode | |
debounceDuration | debounce duration for Search | number | 300 |
ClearSelectedIcon | Custom Clear Icon for Selected Items (Hint: Passnull to prevent it from rendering completely) | ReactNode | |
isCreatable | Allows user to create unavailable option(s)example ↗ | boolean | false |
onCreateOption | allows to override newly created optionexample ↗ | function | |
closeOnChangedValue | automatically closes dropdown when its value is changed | boolean | false |
For every release changelog/migration-guide will be available inreleases
- This project gets inspiration and several pieces of logical code fromreact-multiple-select
- TypeScript
MIT ©harshzalavadiya
About
Lightweight (~5KB gzipped) multiple selection dropdown component
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
