# Time Input (`<z-input-time>`)

> Segmented hour/minute time field with 12h/24h clocks, meridiem toggle, and min/max validation.

- **Kind:** hwc
- **Category:** inputs
- **Inherits:** `InputMixin`, `Hwc`, `Base`

## Attributes

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `autofocus` | `boolean` | `false` | — | Focuses the hour field on mount. |
| `now` | `boolean` | `false` | — | Initializes the value to the current time. |
| `clock` | `'12h' \| '24h'` | `'12h'` | — | Clock notation: `12h` (default, with AM/PM toggle) or `24h`. |
| `min` | `string` | `''` | — | Earliest allowed time (`HH:MM`), validated on commit. |
| `max` | `string` | `''` | — | Latest allowed time (`HH:MM`), validated on commit. |

### Inherited from `InputMixin`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `disabled` | `boolean` | `false` | `InputMixin` | Disables the control so it cannot be interacted with. |
| `form` | `string` | `''` | `InputMixin` | Associates the hidden form input with a form by id, even when the component sits outside that form. |
| `name` | `string` | `''` | `InputMixin` | Field name for the hidden form input; array values submit as `name[]`. |
| `placeholder` | `string` | `''` | `InputMixin` | Placeholder text for the control's empty state. |
| `required` | `boolean` | `false` | `InputMixin` | Marks the control as required. |
| `value` | `string` | `''` | `InputMixin` | Initial value of the control, synchronized with the hidden form input. |

### Inherited from `Hwc`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `i18n` | `string` | `''` | `Hwc` | Per-instance text overrides as `key: text` pairs, merged over the global `z-i18n` script and the built-in defaults. |
| `floating` | `string` | `''` | `Hwc` | Floating UI placement options (for example `offset` and `shiftPadding`) parsed as `key: value` pairs. |
| `force-prevent-rerender` | `boolean` | `false` | `Hwc` | Skips re-rendering after the first render; an existing `data-host-inner` child is adopted as the rendered DOM. |
| `template` | `string` | `''` | `Hwc` | Selector or id of an external element or `<template>` whose inner content is cloned in place of an inline `template[data-fn="template"]` child. |

### Inherited from `Base`

| Attribute | Type | Default | From | Description |
| --- | --- | --- | --- | --- |
| `cls` | `string` | `''` | `Base` | Adds classes to named parts as `key: classes` pairs; a plain string targets the default part. |
| `stl` | `string` | `''` | `Base` | Adds inline styles to named parts as `key: styles` pairs; a plain string targets the default part. |

## Styling Parts (`cls` / `stl`)

Default `cls` target: `container`. Default `stl` target: `container`.

| Key | Default class | cls | stl | Description |
| --- | --- | --- | --- | --- |
| `button` | — | ✓ | — | Fallback class/style key used for the meridiem button when `meridiem-button` is unset. |
| `container` | `z-input-time` | ✓ | ✓ | The field container (default `z-input-time`); the default `cls`/`stl` target. |
| `hour-input` | — | ✓ | — | The hour field. |
| `input` | `z-input` | ✓ | — | Shared input styling class (default `z-input`). |
| `meridiem-button` | `z-input-fake` | ✓ | — | AM/PM toggle in 12h mode (default `z-input-fake`). |
| `minute-input` | — | ✓ | — | The minute field. |
| `separator` | — | ✓ | ✓ | The colon separator between fields. |

## Reference inventories

- [CSS Variables (2)](https://next.0build.dev/docs/components/input-time/css-vars.md)
- [CSS Classes (2)](https://next.0build.dev/docs/components/input-time/css-classes.md)

## i18n Keys

| Key | Default | Description |
| --- | --- | --- |
| `am` | `AM` | AM toggle text. |
| `hour-label` | `Hour` | Accessible label of the hour field. |
| `hour-placeholder` | `HH` | Placeholder of the hour field. |
| `invalid-time` | `Invalid time format` | Error message for out-of-range or malformed times. |
| `meridiem-label` | `AM/PM` | Accessible label of the AM/PM toggle. |
| `minute-label` | `Minute` | Accessible label of the minute field. |
| `minute-placeholder` | `MM` | Placeholder of the minute field. |
| `pm` | `PM` | PM toggle text. |
| `time-label` | `Time` | Accessible label of the time field group. |

## Events

| Event | Cancelable | Detail | Description |
| --- | --- | --- | --- |
| `z-input-time:input` | — | `{ value: string \| string[] }` | Fires when the time changes; `detail.value` carries the `HH:MM` string. |

## Data Hooks

| Attribute | Values | Applies to | Role | Description |
| --- | --- | --- | --- | --- |
| `data-clock` | — | `descendant` | `marker` | Set to the clock mode (`12h`/`24h`). |
| `data-disabled` | — | `descendant` | `marker` | Set while the control is disabled. |
| `data-field` | — | `descendant` | `marker` | Marks the hour/minute fields. |
| `data-host-inner` | — | `descendant` | `config` | Marks the rendered inner wrapper so `force-prevent-rerender` can adopt server-rendered DOM without re-rendering. |
| `data-key` | — | `descendant` | `marker` | Marks keyboard-interactive segments. |
| `data-meridiem` | — | `descendant` | `marker` | Set to the current meridiem (`am`/`pm`). |
| `data-reactive` | — | `descendant` | `config` | Opts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates. |
| `data-valid` | — | `descendant` | `marker` | Reflects whether the current time is valid. |

## Child Content

- `<script data-fn="config">` — JSON configuration script parsed by the base class (i18n, cls, stl, floating).

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `config` | Marks the script as configuration (value: `config`). |
  | `data-reactive` | — | `boolean` | Re-parses the configuration when the script mutates. |

- `<select data-fn="data-source">` — Hidden select parsed into grouped option data by the base class.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `data-source` | Marks the select as the data source (value: `data-source`). |
  | `data-reactive` | — | `boolean` | Re-parses the options when the select mutates. |

  - `<optgroup>` — Groups options under a label.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `label` | ✓ | `string` | Group header text; also the default group key. |
    | `disabled` | — | `boolean` | Disables every option in the group. |
    | `data-key` | — | `string` | Overrides the group key used in the parsed data. |
    | `data-keywords` | — | `comma-separated string` | Comma-separated keywords stored with the group's data. |

    - `<option>` — One option entry within the group.

      | Attribute | Required | Type | Description |
      | --- | --- | --- | --- |
      | `value` | — | `string` | Value carried by this option in the parsed data. |
      | `disabled` | — | `boolean` | Makes the option non-selectable. |
      | `selected` | — | `boolean` | Marks the option as initially selected. |
      | `data-keywords` | — | `comma-separated string` | Extra search terms, comma-separated; searched alongside the label and value. |

  - `<option>` — One ungrouped option entry.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `value` | — | `string` | Value carried by this option in the parsed data. |
    | `disabled` | — | `boolean` | Makes the option non-selectable. |
    | `selected` | — | `boolean` | Marks the option as initially selected. |
    | `data-keywords` | — | `comma-separated string` | Extra search terms, comma-separated. |

- `<template data-fn="icons">` — Instance-level icon repository.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `icons` | Marks the template as an icon source (value: `icons`). |
  | `data-reactive` | — | `boolean` | Re-parses the icons when the template mutates. |

  - `<*>` — One icon element.

    | Attribute | Required | Type | Description |
    | --- | --- | --- | --- |
    | `data-key` | ✓ | `string` | Icon key referenced by `$icons`. |

- `<template data-fn="template">` — Deferred content template mounted by the base class.

  | Attribute | Required | Type | Description |
  | --- | --- | --- | --- |
  | `data-fn` | ✓ | `template` | Marks the template for deferred mounting (value: `template`). |
  | `data-reactive` | — | `boolean` | Re-parses the template when it mutates. |

## Keyboard

| Keys | Action | When |
| --- | --- | --- |
| `ArrowUp` / `ArrowDown` | Increments/decrements the focused hour or minute (wrapping). | — |
| `PageUp` / `PageDown` | Larger steps: ±1 hour, ±15 minutes. | — |
| `ArrowUp` / `ArrowDown` / `Space` | Toggles AM/PM. | The meridiem button is focused (12h clock). |

## Notes

- Typing two digits auto-advances to the next segment; the meridiem toggle cycles AM/PM in 12h mode.
- Times outside `min`/`max` mark the field invalid and show the `invalid-time` message.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)

## Related

- [Date Input](https://next.0build.dev/docs/components/input-date.md)
- [PIN Input](https://next.0build.dev/docs/components/input-pin.md)
