# List

Navigable list with optional filtering



<ComponentPreview base="opentui" name="list-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-list
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="list" title="components/ui/list.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { List } from "@/components/ui/list";
```

```tsx
<List
  items={[
    { key: "ts", label: "TypeScript", description: "Typed JavaScript" },
    { key: "rs", label: "Rust", description: "Systems language" },
    { key: "go", label: "Go", description: "Cloud-native language" },
  ]}
  onSelect={(item) => console.log(item.key)}
/>
```

API Reference [#api-reference]

List [#list]

| Prop         | Type                       | Default    |
| ------------ | -------------------------- | ---------- |
| `items`      | `ListItem[]`               | `required` |
| `onSelect`   | `(item: ListItem) => void` | -          |
| `filterable` | `boolean`                  | `false`    |
| `height`     | `number`                   | `10`       |
| `cursor`     | `string`                   | `"›"`      |

ListItem [#listitem]

| Prop          | Type     | Default    |
| ------------- | -------- | ---------- |
| `key`         | `string` | `required` |
| `label`       | `string` | `required` |
| `description` | `string` | -          |
| `color`       | `string` | -          |
