

<Demo name="time-picker/demos/basic" />

## Installation [#installation]

<CodeBlockTabs defaultValue="npm">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="npm">
      npm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="pnpm">
      pnpm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="yarn">
      yarn
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="bun">
      bun
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="npm">
    ```bash
    npx shadcn@latest add @dotui/time-picker
    ```
  </CodeBlockTab>

  <CodeBlockTab value="pnpm">
    ```bash
    pnpm dlx shadcn@latest add @dotui/time-picker
    ```
  </CodeBlockTab>

  <CodeBlockTab value="yarn">
    ```bash
    yarn dlx shadcn@latest add @dotui/time-picker
    ```
  </CodeBlockTab>

  <CodeBlockTab value="bun">
    ```bash
    bun x shadcn@latest add @dotui/time-picker
    ```
  </CodeBlockTab>
</CodeBlockTabs>

## Usage [#usage]

Use time pickers to allow users to select a time using a field and a scrollable column popover.

```tsx
import { ClockIcon } from 'lucide-react'

import { Button } from '@/components/ui/button'
import { DialogContent } from '@/components/ui/dialog'
import { Label } from '@/components/ui/field'
import { DateInput, InputGroup, InputGroupAddon } from '@/components/ui/input'
import { Popover } from '@/components/ui/popover'
import { TimePicker, TimePickerColumns } from '@/components/ui/time-picker'
```

```tsx
<TimePicker>
  <Label>Time</Label>
  <InputGroup>
    <DateInput />
    <InputGroupAddon>
      <Button variant="default" size="sm" isIconOnly aria-label="Choose time">
        <ClockIcon />
      </Button>
    </InputGroupAddon>
  </InputGroup>
  <Popover>
    <DialogContent>
      <TimePickerColumns />
    </DialogContent>
  </Popover>
</TimePicker>
```

## Examples [#examples]

<Examples className="sm:grid-cols-2">
  <Example name="time-picker/demos/basic" title="Basic" />

  <Example name="time-picker/demos/composition" title="With Label & Description" />

  <Example name="time-picker/demos/granularity" title="Granularity" />

  <Example name="time-picker/demos/hour-cycle" title="Hour Cycle" />
</Examples>

## API Reference [#api-reference]

### TimePicker [#timepicker]

<Reference name="time-picker" />
