# List Box

> Standalone list box for selecting one or more items.

Registry name: `list-box`. HTML docs: https://ui.anuragroy.dev/component/list-box.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/list-box.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/list-box.json`.

Registry JSON: https://ui.anuragroy.dev/r/list-box.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/list-box.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import {
  ListBox,
  ListBoxItem,
  ListBoxSection
} from "@/components/ui/list-box"
```

## Usage

```tsx
import { ListBox, ListBoxItem, ListBoxSection } from "@/components/ui/list-box"

export function Example() {
  return (
    <ListBox defaultValue="a">
      <ListBoxSection label="Letters">
        <ListBoxItem value="a">Alpha</ListBoxItem>
        <ListBoxItem value="b">Beta</ListBoxItem>
      </ListBoxSection>
    </ListBox>
  )
}
```

## API

### ListBox

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string \| string[] | — |  |
| `defaultValue` | string \| string[] | — |  |
| `onValueChange` | (value) => void | — |  |
| `multiple` | boolean | — |  |
| `disabled` | boolean | — |  |

### ListBoxSection

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | React.ReactNode | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/list-box): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/list-box.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
