DocsComponentsTemplatesThemesGitHub

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.json

Guidelines

  • searchable adds a search box at the top of the list; turn it on for 8+ options.
  • multiple shows 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

PropTypeRequired
defaultQuerystringNo
optionalbooleanNo
optionsArray<string | SelectOption>Yes
valuestring | string[]No
defaultValuestring | string[]No
onChange(value: any) => voidNo
multiplebooleanNo
searchablebooleanNo
searchPlaceholderstringNo
onSearch(q: string) => voidNo
loadingbooleanNo
clearablebooleanNo
labelstringNo
hintReact.ReactNodeNo
errorReact.ReactNodeNo
requiredbooleanNo
placeholderstringNo
iconstringNo
size'sm' | 'md'No
widthnumber | stringNo
menuWidthnumberNo
maxHeightnumberNo
maxChipsnumberNo
emptyTextstringNo
defaultOpenbooleanNo
disabledbooleanNo
ariaLabelstring
name when there is no visible label
No
classNamestringNo
styleReact.CSSPropertiesNo

Edit this example on GitHub