A flexible, accessible multi-select component built with React
npm install @tchowdhury/multi-select-reactA flexible, accessible, and feature-rich multi-select component built with React and TypeScript.
- ✅ Fully customizable
- ✅ Keyboard accessible (WCAG)
- ✅ Type-safe with TypeScript
- ✅ Search/filter support
- ✅ Controlled and uncontrolled modes
- ✅ Single and multi-select modes
- ✅ Custom rendering support
- ✅ Zero dependencies (except React)
``bash`
npm install @myorg/multi-select-react
`tsx
import { MultiSelect } from '@myorg/multi-select-react';
import '@myorg/multi-select-react/styles';
const options = [
{ id: '1', label: 'Option 1' },
{ id: '2', label: 'Option 2' },
{ id: '3', label: 'Option 3' },
];
function App() {
const [selected, setSelected] = React.useState([]);
return (
value={selected}
onChange={setSelected}
placeholder="Select options..."
/>
);
}
`
- options - Array of selectable optionsvalue
- - Selected valuesonChange
- - Callback when selection changesplaceholder
- - Placeholder textisSearchable
- - Enable search functionality (default: true)isMulti
- - Allow multiple selections (default: true)isClearable` - Show clear button (default: true)
-
MIT