A simple, customizable, accessible select dropdown for React.
npm install @nixxy/react-simple-selectA lightweight, customizable, and accessible React select component with support for multi-select, async options, and keyboard navigation.
- ✅ Supports both single and multi-select
- ✅ Async options support (fetch data dynamically)
- ✅ Keyboard navigation (Arrow keys, Enter, Escape)
- ✅ Custom icons for options
- ✅ Fully customizable styles (default SCSS provided)
- ✅ Click outside to close
``sh`
yarn add @nixxy/react-simple-select
or
`sh`
npm install @nixxy/react-simple-select
`tsx
import SimpleSelect, { Option } from '@nixxy/react-simple-select';
import '@nixxy/react-simple-select/dist/style.css';
const options: Option[] = [
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
{ label: 'Cherry', value: 'cherry' },
];
export default function Example() {
return (
);
}
`
`tsx`
multiple
onChange={(values) => console.log(values)}
/>
`tsx
const fetchOptions = async () => {
return new Promise
`
| Prop | Type | Default | Description |
| ------------- | ---------------------------------------- | ------------- | ------------------------------------------- |
| options | Option[] or () => Promise
- Arrow Down: Move to the next option
- Arrow Up: Move to the previous option
- Enter: Select the focused option
- Escape: Close the dropdown
You can customize the component using the className prop:
`tsx
import { FiCoffee } from 'react-icons/fi';
options={[{ value: 'coffee', label: 'Coffee', Icon:
/>;
`
If you want full control over the styles, you can skip importing the default CSS and write your own:
`css
/ Base styles /
.nx-simple-select {
/ Custom styles /
}
.nx-simple-select .options {
/ Custom dropdown styles /
}
/ Hide dropdown icon /
.nx-simple-select .select-icon {
display: none;
}
/ Add a background image to .nx-simple-select /
.nx-simple-select {
background-image: url('your-image.png');
}
``
The default styles are primarily for testing, so you’re free to customize them however you like.
---
MIT
Feedback and contributions are welcome! Open an issue or submit a PR.