Select
A powerful dropdown component for selecting single or multiple options from a list. Perfect for forms, filters, and data selection with search functionality, async loading, and customizable styling options.
Import
import { Select } from "@sparrowengg/twigs-react";Usage
const SelectExample = () => {
const [selectedValue, setSelectedValue] = useState(null);
return (
<Select
placeholder="Choose an option..."
options={options}
value={selectedValue}
onChange={setSelectedValue}
size="md"
variant="default"
/>
);
};Examples
Comprehensive Features
The select component supports a wide range of features including multi-select, async loading, grouped options, custom styling, and form integration.
Props
Select
| Prop | Type | Default |
|---|---|---|
options? | OptionType[] | - |
value? | OptionType | OptionType[] | null | - |
onChange? | (value: OptionType | OptionType[] | null) => void | - |
placeholder? | string | - |
label? | string | - |
size? | 'sm' | 'md' | 'lg' | 'xl' | 'sm' |
variant? | 'default' | 'filled' | 'default' |
isMulti? | boolean | false |
isClearable? | boolean | false |
isSearchable? | boolean | true |
isAsync? | boolean | false |
isCreatable? | boolean | false |
loadOptions? | (inputValue: string) => Promise<OptionType[]> | - |
isDisabled? | boolean | false |
error? | string | - |
helperText? | string | - |
requiredIndicator? | boolean | false |
info? | string | ReactNode | - |
labelRightAddon? | ReactNode | - |
showSeparator? | boolean | false |
dropdownIndicatorIcon? | ReactElement | - |
dropdownIndicatorPosition? | 'left' | 'right' | 'right' |
menuPortalTarget? | HTMLElement | null | - |
className? | string | - |
css? | object | - |
Radio
A set of checkable buttons where only one can be selected at a time. Perfect for single-choice selections with keyboard navigation, accessibility features, and customizable sizing options.
Separator
A visual divider that separates content sections both horizontally and vertically. Perfect for organizing layouts, navigation menus, and content sections with clean visual separation.