> ## Documentation Index
> Fetch the complete documentation index at: https://araf.badr.co.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Select

> A dropdown selector for choosing one option from a list — supports labels, grouped options, placeholder, and validation states.

## Overview

<div style={{display:"flex",gap:"24px",flexWrap:"wrap",padding:"28px 24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb",alignItems:"flex-start"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",minWidth:"200px"}}>
    <label style={{fontSize:"13px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Country</label>

    <div style={{border:"1px solid #D0D5DD",borderRadius:"8px",padding:"9px 13px",fontSize:"14px",color:"#667085",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center"}}>
      <span>Select country</span>
      <span style={{color:"#667085",fontSize:"12px"}}>▾</span>
    </div>

    <span style={{fontSize:"11px",color:"#71717a",fontFamily:"Inter,sans-serif"}}>Default</span>
  </div>

  <div style={{display:"flex",flexDirection:"column",gap:"6px",minWidth:"200px"}}>
    <label style={{fontSize:"13px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Country</label>

    <div style={{border:"1px solid #0479CE",borderRadius:"8px",padding:"9px 13px",fontSize:"14px",color:"#101828",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center",boxShadow:"0 0 0 4px #CDE4F5"}}>
      <span>Indonesia</span>
      <span style={{color:"#667085",fontSize:"12px"}}>▾</span>
    </div>

    <span style={{fontSize:"11px",color:"#71717a",fontFamily:"Inter,sans-serif"}}>Focus</span>
  </div>

  <div style={{display:"flex",flexDirection:"column",gap:"6px",minWidth:"200px"}}>
    <label style={{fontSize:"13px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Department</label>

    <div style={{border:"1px solid #DC2626",borderRadius:"8px",padding:"9px 13px",fontSize:"14px",color:"#101828",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center"}}>
      <span>Select department</span>
      <span style={{color:"#667085",fontSize:"12px"}}>▾</span>
    </div>

    <span style={{fontSize:"11px",color:"#B42318",fontFamily:"Inter,sans-serif"}}>⚠ Please select a department</span>
  </div>
</div>

**Select** provides a styled dropdown for single-option selection. It supports grouped options, searchable filtering, disabled items, and validation states via a trigger + content popover pattern.

***

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @araf-ds/core
  ```

  ```bash yarn theme={null}
  yarn add @araf-ds/core
  ```

  ```bash pnpm theme={null}
  pnpm add @araf-ds/core
  ```
</CodeGroup>

***

## Usage

```tsx theme={null}
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
} from "@araf-ds/core"

export default function Example() {
  return (
    <Select onValueChange={(val) => console.log(val)}>
      <SelectTrigger label="Country" placeholder="Select country" />
      <SelectContent>
        <SelectItem value="id">Indonesia</SelectItem>
        <SelectItem value="sg">Singapore</SelectItem>
        <SelectItem value="my">Malaysia</SelectItem>
      </SelectContent>
    </Select>
  )
}
```

***

## Variants

### Basic Select

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",maxWidth:"280px"}}>
    <label style={{fontSize:"14px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Country</label>

    <div style={{border:"1px solid #D0D5DD",borderRadius:"8px",padding:"10px 14px",fontSize:"14px",color:"#667085",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}}>
      <span>Select country</span>
      <span style={{fontSize:"12px",color:"#667085"}}>▾</span>
    </div>
  </div>
</div>

```tsx theme={null}
<Select onValueChange={(val) => console.log(val)}>
  <SelectTrigger label="Country" placeholder="Select country" />
  <SelectContent>
    <SelectItem value="id">Indonesia</SelectItem>
    <SelectItem value="sg">Singapore</SelectItem>
    <SelectItem value="my">Malaysia</SelectItem>
  </SelectContent>
</Select>
```

### With Selected Value

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",maxWidth:"280px"}}>
    <label style={{fontSize:"14px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Country</label>

    <div style={{border:"1px solid #D0D5DD",borderRadius:"8px",padding:"10px 14px",fontSize:"14px",color:"#101828",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}}>
      <span>Indonesia</span>
      <span style={{fontSize:"12px",color:"#667085"}}>▾</span>
    </div>
  </div>
</div>

```tsx theme={null}
<Select defaultValue="id">
  <SelectTrigger label="Country" />
  <SelectContent>
    <SelectItem value="id">Indonesia</SelectItem>
    <SelectItem value="sg">Singapore</SelectItem>
  </SelectContent>
</Select>
```

### Grouped Options

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",maxWidth:"280px"}}>
    <label style={{fontSize:"14px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Role</label>

    <div style={{border:"1px solid #D0D5DD",borderRadius:"8px",padding:"10px 14px",fontSize:"14px",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",flexDirection:"column",gap:"0"}}>
      <div style={{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}}>
        <span style={{color:"#667085"}}>Select role</span>
        <span style={{fontSize:"12px",color:"#667085"}}>▾</span>
      </div>

      <div style={{borderTop:"1px solid #F4F4F5",paddingTop:"8px",display:"flex",flexDirection:"column",gap:"4px"}}>
        <div style={{fontSize:"11px",fontWeight:600,color:"#9CA3AF",padding:"4px 8px",letterSpacing:"0.05em"}}>MANAGEMENT</div>
        <div style={{padding:"8px 8px",color:"#101828",borderRadius:"6px",cursor:"pointer",background:"#F4F4F5"}}>Administrator</div>
        <div style={{padding:"8px 8px",color:"#101828",borderRadius:"6px",cursor:"pointer"}}>Manager</div>
        <div style={{fontSize:"11px",fontWeight:600,color:"#9CA3AF",padding:"8px 8px 4px",letterSpacing:"0.05em"}}>OPERATIONAL</div>
        <div style={{padding:"8px 8px",color:"#101828",borderRadius:"6px",cursor:"pointer"}}>Editor</div>
        <div style={{padding:"8px 8px",color:"#667085",borderRadius:"6px",cursor:"not-allowed",opacity:0.5}}>Viewer (disabled)</div>
      </div>
    </div>
  </div>
</div>

```tsx theme={null}
<Select>
  <SelectTrigger label="Role" placeholder="Select role" />
  <SelectContent>
    <SelectGroup>
      <SelectLabel>Management</SelectLabel>
      <SelectItem value="admin">Administrator</SelectItem>
      <SelectItem value="manager">Manager</SelectItem>
    </SelectGroup>
    <SelectSeparator />
    <SelectGroup>
      <SelectLabel>Operational</SelectLabel>
      <SelectItem value="editor">Editor</SelectItem>
      <SelectItem value="viewer" disabled>Viewer</SelectItem>
    </SelectGroup>
  </SelectContent>
</Select>
```

### Error State

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",maxWidth:"280px"}}>
    <label style={{fontSize:"14px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif"}}>Department</label>

    <div style={{border:"1px solid #DC2626",borderRadius:"8px",padding:"10px 14px",fontSize:"14px",color:"#667085",fontFamily:"Inter,sans-serif",background:"#fff",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}}>
      <span>Select department</span>
      <span style={{fontSize:"12px",color:"#667085"}}>▾</span>
    </div>

    <span style={{fontSize:"13px",color:"#B42318",fontFamily:"Inter,sans-serif"}}>Please select a department</span>
  </div>
</div>

```tsx theme={null}
<Select>
  <SelectTrigger
    label="Department"
    placeholder="Select department"
    state="error"
    helperText="Please select a department"
  />
  <SelectContent>
    <SelectItem value="eng">Engineering</SelectItem>
    <SelectItem value="design">Design</SelectItem>
  </SelectContent>
</Select>
```

### Disabled

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{display:"flex",flexDirection:"column",gap:"6px",maxWidth:"280px"}}>
    <label style={{fontSize:"14px",fontWeight:500,color:"#344054",fontFamily:"Inter,sans-serif",opacity:0.5}}>Region</label>

    <div style={{border:"1px solid #E5E7EB",borderRadius:"8px",padding:"10px 14px",fontSize:"14px",color:"#9ca3af",fontFamily:"Inter,sans-serif",background:"#F9FAFB",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"not-allowed",opacity:0.6}}>
      <span>Select region</span>
      <span style={{fontSize:"12px",color:"#9ca3af"}}>▾</span>
    </div>
  </div>
</div>

```tsx theme={null}
<Select disabled>
  <SelectTrigger label="Region" placeholder="Select region" state="disabled" />
  <SelectContent>
    <SelectItem value="asia">Asia Pacific</SelectItem>
  </SelectContent>
</Select>
```

***

## States

| State    | Border    | Ring          | Helper text color |
| -------- | --------- | ------------- | ----------------- |
| Default  | `#D0D5DD` | —             | `#667085`         |
| Focus    | `#0479CE` | `#CDE4F5` 4px | —                 |
| Error    | `#DC2626` | —             | `#B42318`         |
| Disabled | `#E5E7EB` | —             | —                 |

***

## API Reference

### Select (Root)

<ParamField path="value" type="string">
  Controlled selected value.
</ParamField>

<ParamField path="onValueChange" type="(value: string) => void">
  Callback fired when the selected value changes.
</ParamField>

<ParamField path="defaultValue" type="string">
  Uncontrolled default selected value.
</ParamField>

<ParamField path="disabled" type="boolean" default="false">
  Disables the entire select component.
</ParamField>

### SelectTrigger

<ParamField path="label" type="string">
  Label displayed above the trigger.
</ParamField>

<ParamField path="placeholder" type="string" default="Select...">
  Placeholder text shown when nothing is selected.
</ParamField>

<ParamField path="state" type="string" default="default">
  Validation state. Values: `default` · `error` · `disabled`
</ParamField>

<ParamField path="helperText" type="string">
  Helper or error message displayed below the trigger.
</ParamField>

### SelectItem

<ParamField path="value" type="string">
  The option value (required).
</ParamField>

<ParamField path="disabled" type="boolean" default="false">
  Disables this specific option.
</ParamField>

***

## Accessibility

* Select uses `role="combobox"` on the trigger and `role="listbox"` on the content
* Keyboard navigation: Arrow keys move between options, Enter/Space selects, Escape closes
* Selected option is marked with `aria-selected="true"`
* Disabled options use `aria-disabled="true"` and are skipped by keyboard navigation
* Label is associated with the trigger via `aria-labelledby`
* Error messages are linked via `aria-describedby`

***

## Do's & Don'ts

<CardGroup cols={2}>
  <Card title="Do" icon="check" iconType="solid" color="#16A34A">
    * Use Select for 5+ options where a Radio Group would be too long
    * Always include a descriptive label above the trigger
    * Use grouped options when the list has multiple logical categories
    * Show an error state with a clear helper text on validation failure
  </Card>

  <Card title="Don't" icon="xmark" iconType="solid" color="#DC2626">
    * Don't use Select for fewer than 3–4 options — use Radio Group instead
    * Don't use placeholder as a substitute for a label
    * Don't disable the entire Select without explaining why
    * Don't put more than 20 options in a flat list — use grouping or search
  </Card>
</CardGroup>
