Skip to content

Select

A choice from a list that opens from a trigger. The value is the chosen option id; selectionMode="multiple" takes several. Use ComboBox when the list is long enough to search.

Language
Appearance

Labelled, with icons

ChannelWhere the reminder is sent.
import { ChatCircleIcon, PhoneIcon, WhatsappLogoIcon } from '@phosphor-icons/react';
import { useState } from 'react';
import type { Key } from 'react-aria-components';
import { Select, SelectItem } from '@arbol-ai/ui';

const ChannelExample = () => {
  const [channel, setChannel] = useState<Key | null>('whatsapp');
  return (
    <Select
      className="max-w-xs"
      description="Where the reminder is sent."
      label="Channel"
      onChange={setChannel}
      value={channel}
    >
      <SelectItem id="whatsapp" textValue="WhatsApp">
        <WhatsappLogoIcon aria-hidden /> WhatsApp
      </SelectItem>
      <SelectItem id="web" textValue="Web chat">
        <ChatCircleIcon aria-hidden /> Web chat
      </SelectItem>
      <SelectItem id="voice" textValue="Phone call">
        <PhoneIcon aria-hidden /> Phone call
      </SelectItem>
    </Select>
  );
};

<ChannelExample />

Sections

Appointment status
import { Select, SelectItem, SelectSection } from '@arbol-ai/ui';

<Select className="max-w-xs" defaultValue="confirmed" label="Appointment status">
  <SelectSection title="Upcoming">
    <SelectItem id="booked">Booked</SelectItem>
    <SelectItem id="confirmed">Confirmed</SelectItem>
  </SelectSection>
  <SelectSection title="Closed">
    <SelectItem id="attended">Attended</SelectItem>
    <SelectItem id="no-show">No-show</SelectItem>
    <SelectItem id="cancelled">Cancelled</SelectItem>
  </SelectSection>
</Select>

Several options

Calling days
import { Select, SelectItem } from '@arbol-ai/ui';

<Select
  className="max-w-xs"
  defaultValue={['mon', 'wed']}
  label="Calling days"
  selectionMode="multiple"
>
  <SelectItem id="mon">Monday</SelectItem>
  <SelectItem id="tue">Tuesday</SelectItem>
  <SelectItem id="wed">Wednesday</SelectItem>
  <SelectItem id="thu">Thursday</SelectItem>
  <SelectItem id="fri">Friday</SelectItem>
</Select>

Compact, in a toolbar

import { Select, SelectItem } from '@arbol-ai/ui';

<Select aria-label="Agent" className="w-44" defaultValue="all" size="sm">
  <SelectItem id="all">All agents</SelectItem>
  <SelectItem id="front-desk">Front desk</SelectItem>
  <SelectItem id="collections">Collections</SelectItem>
</Select>

Source

The examples above are src/components/select/select.examples.tsx, which the library’s tests render too.

Type to search…

↑↓ navigate↵ selectEsc close