Select
Design dropdown (no native select): single or multiple, optional search box, groups, icons, descriptions, clearable, keyboard support.
Code
import * as React from 'react';
import { Select } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
maxWidth: 340,
minHeight: 330,
}}
>
<Select
label="Assignee"
searchable
defaultOpen
placeholder="Choose a person"
defaultValue="mk"
options={[
{
value: 'al',
label: 'Ada Lovelace',
description: 'Design',
group: 'Team',
},
{
value: 'mk',
label: 'Marco Kim',
description: 'Engineering',
group: 'Team',
},
{
value: 'js',
label: 'Jia Song',
description: 'Engineering',
group: 'Team',
},
{
value: 'rt',
label: 'Rosa Torres',
description: 'Guest',
group: 'Guests',
meta: 'Invited',
},
]}
/>
</div>
);
}Multiple
import { Select } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560 }}>
<Select label="Channels" multiple clearable options={['Email', 'SMS', 'Push', 'Slack']} defaultValue={['Email', 'Push']} />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Select } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/select.jsonGuidelines
searchableadds a search box at the top of the list; turn it on for 8+ options.multipleshows chips and a Clear/Done footer (or use MultiSelect).- Options may carry
group,icon,description,meta,disabled. - Fewer than 5 options and space to show them: RadioGroup or SegmentedControl.
Props
| Prop | Type | Required |
|---|---|---|
defaultQuery | string | No |
optional | boolean | No |
options | Array<string | SelectOption> | Yes |
value | string | string[] | No |
defaultValue | string | string[] | No |
onChange | (value: any) => void | No |
multiple | boolean | No |
searchable | boolean | No |
searchPlaceholder | string | No |
onSearch | (q: string) => void | No |
loading | boolean | No |
clearable | boolean | No |
label | string | No |
hint | React.ReactNode | No |
error | React.ReactNode | No |
required | boolean | No |
placeholder | string | No |
icon | string | No |
size | 'sm' | 'md' | No |
width | number | string | No |
menuWidth | number | No |
maxHeight | number | No |
maxChips | number | No |
emptyText | string | No |
defaultOpen | boolean | No |
disabled | boolean | No |
ariaLabel | stringname when there is no visible label | No |
className | string | No |
style | React.CSSProperties | No |