// preview in
saved for every page

Time field

Types a time into hour, minute and AM/PM segments, on the locale's clock. Carries a time zone when the value has one, so a meeting at 2 PM means the same moment for everyone.

Built on React AriaPattern WAI-ARIA Spinbutton (one per segment)Client componentSource ↗
minimal · light · #3fa34d
1145AM
granularity
readOnly
invalid
disabled

Installation

Set up Camaleo once (Installation), then import what you need. Time is a time of day; ZonedDateTime adds a date and a time zone. Both are re-exported from the package.

import { TimeField, Time, ZonedDateTime, Field, FieldLabel } from "@camaleo/react";

Anatomy

The same parts as DateField: a box with one segment per part of the time, and literals like : between them.

input1000AM
[data-slot="time-field"][data-slot="date-input"][data-slot="date-segment"]

Examples

Every example is a real file you can copy. They all wear the skin, mode and brand from the bar above.

minimal · light · #3fa34d
1000AM

Shown on your store page and in Maps.

1000AM
1230PM

Length: 2 h 30 min

Start and end

Change either time. Two controlled fields give you the length, and the end field turns invalid when it comes before the start.

1000PM
Pick a time between 8:00 AM and 6:00 PM.

Within business hours

Set a time from 8:00 AM to 6:00 PM. minValue and maxValue mark anything outside invalid, and FieldError says the allowed range.

1030PM
2230

12 or 24 hours

The locale picks the clock. hourCycle forces one, for a timetable or an audience that expects it.

001248

Hours, minutes and seconds into the video.

Seconds

granularity="second" adds a segment for timestamps and durations. Use "hour" when only the hour matters.

1000AMGMT-3

Shown in the organizer's time zone.

With a time zone

A ZonedDateTime shows its zone as a read-only segment, so people in other cities know whose 10 AM it is. hideTimeZone drops it.

––––AM

Press Arrow Up: it starts at 7:00 AM, not midnight.

Placeholder value

An empty field starts from midnight. placeholderValue starts the arrows at a likely time without filling it in.

1100AM

Set by the hotel. Ask the front desk for a late check-out.

Read-only

readOnly keeps the time focusable and readable by screen readers. Say who sets it.

In context

Times come with dates and schedules. These are whole pieces of UI you can copy, in the skin you picked.

Opening hours

Café Aurora · 12 Bay Street

0700AM
0600PM
0700AM
0800PM
0800AM
0200PM
0800AM
1200PM
Opening hoursCard · Switch · TimeField · Button

Schedule a call

30-minute intro with Marcus Lee.

11172026
1000AM
1030AM
Meeting schedulerCard · DateField · TimeField · Button

Daily summary

One email with yesterday's sales and today's orders.

1000AM

In your time zone, New York (EST).

Daily summaryCard · Switch · TimeField · Checkbox

Guidelines

1000AMGMT-3
DoShow the zone when people are in different places.

A ZonedDateTime prints it next to the time, so nobody joins an hour early.

1000AM
Don’tA bare time for a global event.

Everyone reads "10:00 AM" in their own zone, and most of them are wrong.

Team stand-up
1030AM
1045AM
DoTwo labeled fields for a range.

Start and end are each validated and read on their own.

Don’tA text box for times.

"10:30 to 10:45-ish" can't be parsed, sorted or checked against the clock.

Props

PropTypeDefaultDescription
classNamestring—Classes added to the root.
styleCSSProperties—Inline styles for the root.
disabledboolean—Disables every segment. Inside a Field, the field's disabled is used when this is not set.
readOnlybooleanfalseKeeps the value focusable and readable, but not editable.
invalidboolean—Marks the field invalid. Inside a Field, the field's invalid is used when this is not set.
requiredbooleanfalseMarks the field required for assistive tech.
localestring—BCP 47 locale for the clock and the AM/PM labels, such as "en-US" or "pt-BR". Defaults to the nearest I18nProvider or the browser's language.
valueTimeValue | null—The current value (controlled).
defaultValueTimeValue | null—The default value (uncontrolled).
onChange(value: TimeValue | null) => void—Handler that is called when the value changes.
namestring—The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
autoFocusboolean—Whether the element should receive focus on render.
hourCycle12 | 24—Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale.
granularity"hour" | "minute" | "second"'minute'Determines the smallest unit that is displayed in the time picker.
hideTimeZoneboolean—Whether to hide the time zone abbreviation.
shouldForceLeadingZerosboolean—Whether to always show leading zeros in the hour field. By default, this is determined by the user's locale.
placeholderValueTimeValue—A placeholder time that influences the format of the placeholder shown when no value is selected. Defaults to 12:00 AM or 00:00 depending on the hour cycle.
minValueTimeValue—The minimum allowed time that a user may select.
maxValueTimeValue—The maximum allowed time that a user may select.

TimeValue is Time, CalendarDateTime or ZonedDateTime; the value you pass is the type you get back in onChange. validationBehavior defaults to "aria": an out-of-range time marks the field invalid but never blocks the form.

Styling hooks

Restyle it without forking: target the attributes, or set the tokens on a parent, a skin or the field itself.

Attributes

data-slot"time-field" · "date-input" · "date-segment"
data-invalidon the root and segments when invalid
data-disabled · data-readonlyon the root and segments when disabled · read-only
data-placeholderon a segment with no value yet
data-typea segment's part: hour · minute · second · dayPeriod · timeZoneName · literal
data-focusedon the segment that has focus

Tokens it reads

Color

--cml-accent--cml-accent-fg--cml-border-control--cml-danger--cml-fg--cml-fg-muted--cml-field-bg--cml-field-border-sides--cml-field-shadow--cml-focus-ring

Shape & size

--cml-field-border-width--cml-field-height--cml-field-padding--cml-font-size-field--cml-radius-control--cml-radius-field

Type & motion

--cml-duration-fast--cml-ease-standard--cml-font-field

This component only

--cml-corner-shape--cml-disabled-opacity--cml-segment-focus-bg--cml-segment-focus-border--cml-segment-focus-fg--cml-segment-focus-shadow--cml-segment-radius
/* a quieter time zone label */
[data-slot="time-field"] [data-type="timeZoneName"] {
  color: var(--cml-fg-muted);
  font-size: 0.875em;
}

Accessibility

0–9Types into the focused segment and moves on when it is full.
A · PSets AM or PM in the period segment.
Arrow Up · Arrow DownAdds or subtracts one, wrapping at the end of the segment.
Arrow Left · Arrow RightMoves between segments.
Page Up · Page DownSteps by a bigger amount, like 15 minutes.
BackspaceClears the focused segment.
Was this page helpful? · Edit this page on GitHub