Dropdown
A versatile dropdown component for selecting single options with search and clear functionality.
Basic Usage
Basic Dropdown
import { Dropdown } from 'fluxo-ui';
function MyComponent() {
const [value, setValue] = useState('');
const options = [
{ label: 'Option 1', value: 'option1' },
{ label: 'Option 2', value: 'option2' },
{ label: 'Option 3', value: 'option3' },
{ label: 'Disabled Option', value: 'disabled', disabled: true }
];
return (
<Dropdown
label="Select an option"
placeholder="Choose one..."
options={options}
value={value}
onChange={setValue}
/>
);
}Searchable Dropdown
Dropdown with Search
const frameworkOptions = [
{ label: 'React', value: 'react' },
{ label: 'Vue.js', value: 'vue' },
{ label: 'Angular', value: 'angular' },
{ label: 'Svelte', value: 'svelte' },
// ... more options
];
<Dropdown
label="Frontend Framework"
placeholder="Search frameworks..."
options={frameworkOptions}
value={value}
onChange={setValue}
searchable
/>Clearable Dropdown
Dropdown with Clear Button
<Dropdown
label="Country"
options={countryOptions}
value={value}
onChange={setValue}
showClear
/>Grouped Options
Dropdown with Grouped Items
const groupedOptions = [
{
label: 'Frontend',
items: [
{ label: 'React', value: 'react' },
{ label: 'Vue.js', value: 'vue' },
{ label: 'Angular', value: 'angular' },
],
},
{
label: 'Backend',
items: [
{ label: 'Node.js', value: 'nodejs' },
{ label: 'Django', value: 'django' },
],
},
];
<Dropdown
label="Technology"
placeholder="Select a technology..."
options={groupedOptions}
value={value}
onChange={setValue}
searchable
/>Custom Field Mapping
Dropdown with optionLabel / optionValue
const countries = [
{ name: 'United States', code: 'US' },
{ name: 'Canada', code: 'CA' },
{ name: 'United Kingdom', code: 'UK' },
{ name: 'Germany', code: 'DE' },
];
<Dropdown
label="Country"
placeholder="Select a country..."
options={countries}
optionLabel="name"
optionValue="code"
value={value}
onChange={setValue}
/>States
Dropdown States
This field is required
<Dropdown label="Normal" placeholder="Normal state" options={options} />
<Dropdown label="Selected" options={options} value="option2" onChange={setValue} />
<Dropdown label="Disabled" placeholder="Disabled state" options={options} disabled />
<Dropdown label="Read Only" options={options} value="option1" readonly />
<Dropdown label="Required" placeholder="Required field" options={options} required />
<Dropdown label="With Error" options={options} error="This field is required" />Import
import { Dropdown } from 'fluxo-ui';Props
valueanyCurrently selected value (controlled component)
valueanyCurrently selected value (controlled component)
optionsreqListItem[] | ListItemGroup[]Flat array of items or grouped items. Each group has a label, optional icon, and an items array.
optionsreqListItem[] | ListItemGroup[]Flat array of items or grouped items. Each group has a label, optional icon, and an items array.
onChangefunctionChange event handler called with {event, value, name, args}
onChangefunctionChange event handler called with {event, value, name, args}
placeholderstringPlaceholder text when no option is selected
placeholderstringPlaceholder text when no option is selected
labelstringLabel text for the dropdown
labelstringLabel text for the dropdown
errorstringError message to display
errorstringError message to display
disabledbooleanfalseDisable the dropdown
disabledbooleanfalseDisable the dropdown
readonlybooleanfalseMake the dropdown read-only
readonlybooleanfalseMake the dropdown read-only
requiredbooleanfalseMark the dropdown as required
requiredbooleanfalseMark the dropdown as required
searchablebooleanfalseEnable search/filter functionality
searchablebooleanfalseEnable search/filter functionality
loadingbooleanfalseShow loading state
loadingbooleanfalseShow loading state
emptyMessagestring"No options available"Message to display when no options are available
emptyMessagestring"No options available"Message to display when no options are available
showClearbooleanfalseShow clear button to deselect
showClearbooleanfalseShow clear button to deselect
renderItemfunctionCustom render function for dropdown items: (item, index, isSelected, isHighlighted) => ReactNode
renderItemfunctionCustom render function for dropdown items: (item, index, isSelected, isHighlighted) => ReactNode
renderValuefunctionCustom render function for selected value: (item) => ReactNode
renderValuefunctionCustom render function for selected value: (item) => ReactNode
idstringHTML id attribute for the input element
idstringHTML id attribute for the input element
namestringHTML name attribute for form submission
namestringHTML name attribute for form submission
argsanyCustom arguments passed to onChange event
argsanyCustom arguments passed to onChange event
optionLabelstring"label"Property name to use as the display label from each option object
optionLabelstring"label"Property name to use as the display label from each option object
optionValuestring"value"Property name to use as the value from each option object
optionValuestring"value"Property name to use as the value from each option object
classNamestringAdditional CSS classes
classNamestringAdditional CSS classes
Features
Single Select
Controlled single-value selection with clear and searchable support
Searchable
Built-in filter input to quickly find options in long lists
Clearable
Optional clear button to reset selected value to empty
Grouped Options
Organize options into labeled groups with nested item arrays
Custom Field Mapping
optionLabel and optionValue props map any data shape to the dropdown
Custom Rendering
renderItem and renderValue callbacks for full JSX control over items
States
Disabled, read-only, required, error, and loading states built in
Accessibility
ARIA roles, keyboard navigation, and screen reader support
Theming
Full dark/light + 5 brand themes via CSS variables — zero extra config