# Time input

A field for a time of day, "14:30". It is the browser's own time field, so it shows the hours the way the person's locale does (24-hour or with AM and PM) and its parts are reached with the keyboard; the value is always 24-hour "HH:MM" (or "HH:MM:SS" with a `step` under 60). Empty is "", never midnight.

A time with no zone is ambiguous across a team, so say which one with `timeZone`: it is printed after the field and read with it. Use `Field` for the label, hint and error.

- Registry name: `time-input` (`@candor/time-input`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/time-input

## Install

```bash
npx candor-ui add time-input
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/time-input`.
It brings in: input, locale, tokens, utils.

## Example

```tsx
"use client"

import * as React from "react"
import { Field } from "@/components/ui/field"
import { TimeInput } from "@/components/ui/time-input"

// The value is always 24-hour "HH:MM"; the field shows it as the person's locale does. Say which zone it is in.
export default function Example() {
  const [time, setTime] = React.useState("09:00")
  return (
    <Field label="Send the daily digest at" className="w-full max-w-xs">
      <TimeInput value={time} onValueChange={setTime} timeZone="UTC" />
    </Field>
  )
}
```

## <TimeInput>

Props:

- `value?: string | undefined`: The time as "HH:MM", when you control it. "" is empty.
- `defaultValue?: string | undefined`: The time at first, when you don't control it.
- `onValueChange?: ((value: string) => void) | undefined`: Called with "HH:MM" (or "HH:MM:SS") as the person changes it, or "" when they clear it.
- `timeZone?: string | undefined`: The zone the time is in, as people should read it: "UTC", "Europe/London", "your workspace's time".
- `attend?: boolean | undefined`: Rings the field once, as `Input`'s `attend` does, after a failed submit.
- `"aria-describedby"?: string | undefined`: Ids of anything else that describes the field; the zone's id is added after them.

Also takes the props of `Omit<React.ComponentProps<"input">, "value" | "defaultValue" | "type" | "onChange">`.

## Strings (`timeInput`)

The fixed words, English by default. Override any of them under `timeInput` in `<LocaleProvider strings={{ timeInput: { … } }}>`; the table is exported as `timeInputStrings`.

- `zone`: Time zone: {zone}

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
