# Time Field (/forms/time-field)





<ComponentPreview name="time-field-preskok-demo" description="Time field with segmented input." />

## Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger id="cli">
      CLI
    </TabsTrigger>

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

  <TabsContent id="cli">
    ```bash
    npx shadcn@latest add @preskok/time-field
    ```
  </TabsContent>

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

        <ComponentSource name="time-field" title="registry/preskok/ui/preskok-ui/time-field.tsx" />
      </Step>

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

## Usage [#usage]

```tsx
import { DateInput } from "@/components/ui/preskok-ui/date-field"
import { Label } from "@/components/ui/preskok-ui/field"
import { TimeField } from "@/components/ui/preskok-ui/time-field"

export function TimeFieldDemo() {
  return (
    <TimeField>
      <Label>Time</Label>
      <DateInput />
    </TimeField>
  )
}
```

## Examples [#examples]

### Hour Cycle Toggle [#hour-cycle-toggle]

<ComponentPreview name="time-field-hour-cycle-preskok-demo" description="Switch between 12-hour and 24-hour time entry." />

### Validation With Business Hours [#validation-with-business-hours]

<ComponentPreview name="time-field-validation-preskok-demo" description="Required time field with opening-hours validation and a 12/24-hour format toggle." />
