@ryvora/react-select
v3.0.0
Published
๐ฝโ๏ธ Accessible, customizable select dropdown for React. Keyboard navigation, ARIA, and more!
Maintainers
Readme
Select (Dropdown) ๐ฝโ๏ธ
Well hello there, Choice Champion! ๐
The select module is your ultimate tool for creating highly accessible and customizable dropdown select menus. It allows users to choose an option from a list, just like a native <select> element, but with superpowers! ๐ฆธโโ๏ธ
It's like a magic hat ๐ฉ โ you ask for choices, and it presents them beautifully!
Awesome Features:
- ๐ฏ Super Accessible: Full keyboard navigation, ARIA attributes, and screen reader support.
- ๐จ Fully Styleable: Customize every part to match your design system.
- ๐งฉ Composable API:
Select.Root: The main wrapper.Select.Trigger: The button that opens the dropdown.Select.Value: Displays the selected value (can have a placeholder).Select.Icon: A little dropdown arrow icon.Select.Portal: To render the dropdown content in a different part of the DOM.Select.Content: The container for the list of items.Select.Viewport: The scrollable area within the content.Select.Item: A selectable option.Select.ItemText: The text content of an item.Select.ItemIndicator: A checkmark or other indicator for the selected item.Select.Group&Select.Label: For organizing items.Select.Separator: A visual divider.
- โจ๏ธ Type-ahead: Users can type to quickly find options.
Quick Pick Example:
import * as Select from '@ryvora/react-select';
function MyFruitSelector() {
return (
<Select.Root defaultValue="apple">
<Select.Trigger aria-label="Fruit">
<Select.Value placeholder="Select a fruit..." />
<Select.Icon />
</Select.Trigger>
<Select.Portal>
<Select.Content>
<Select.Viewport>
<Select.Item value="apple">
<Select.ItemText>Apple ๐</Select.ItemText>
<Select.ItemIndicator />
</Select.Item>
<Select.Item value="banana">
<Select.ItemText>Banana ๐</Select.ItemText>
<Select.ItemIndicator />
</Select.Item>
<Select.Item value="orange" disabled>
<Select.ItemText>Orange ๐ (Sold Out!)</Select.ItemText>
<Select.ItemIndicator />
</Select.Item>
</Select.Viewport>
</Select.Content>
</Select.Portal>
</Select.Root>
);
}Help your users make the perfect choice, every time! โจ๐
