# Command: Scrollable

> Long lists scroll inside a capped height. The selected item is always kept in view while you move with the keyboard.

Example: https://hextaui.com/docs/command/examples/scrollable
Component docs: https://hextaui.com/docs/command.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/command-scrollable.json
```

This adds `components/examples/command/scrollable.tsx` with the Command component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/command/scrollable.tsx"
import { IconFileText } from "@tabler/icons-react"

import {
  Command,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
} from "@/components/ui/command"

const documents = Array.from({ length: 60 }, (_, index) => ({
  id: index + 1,
  title: `Document ${String(index + 1).padStart(2, "0")}`,
}))

export function CommandScrollable() {
  return (
    <Command className="w-full max-w-sm">
      <CommandInput placeholder="Search 60 documents…" />
      <CommandList>
        <CommandEmpty>No documents match.</CommandEmpty>
        <CommandGroup heading="Documents">
          {documents.map((doc) => (
            <CommandItem key={doc.id}>
              <IconFileText />
              {doc.title}
            </CommandItem>
          ))}
        </CommandGroup>
      </CommandList>
    </Command>
  )
}
```

## Props in this example

### CommandInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `placeholder` | `string` | – |  |

### CommandGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `ReactNode` | – |  |

## More Command examples

- [Basic](https://hextaui.com/docs/command/examples/basic.md)
- [Dialog](https://hextaui.com/docs/command/examples/dialog.md)
- [Pages](https://hextaui.com/docs/command/examples/pages.md)
- [Async results](https://hextaui.com/docs/command/examples/async.md)
- [Long content](https://hextaui.com/docs/command/examples/long-content.md)
- [Right to left](https://hextaui.com/docs/command/examples/rtl.md)
