Text input with a clock trigger button that opens a TimePicker in a popover. Accepts both typed and picked times, held as an HH:mm:ss string.
Use @uxf/ui/time-picker-input for a standalone, controlled time field — you own the value/onChange state.
Inside a @uxf/form form, use the twin @uxf/form/time-picker-input instead: it wires the field into react-hook-form (useController), adds required/format validation, and reads the disabled/read-only flags from the form context. This ui component is the underlying controlled primitive it renders.
import { TimePickerInput } from "@uxf/ui/time-picker-input";
import { useState } from "react";
function Example() {
const [value, setValue] = useState<string | null>(null);
return (
<TimePickerInput
isClearable
label="Time"
name="time"
onChange={setValue}
placeholder="Enter time…"
value={value}
/>
);
}
Extends InputWithPopoverProps<string | null> (from @uxf/ui/_input-with-popover), so it accepts the standard field props: label, helperText, hiddenLabel, isClearable, isDisabled, isReadOnly, isInvalid, isRequired, size, variant, leftAddon/rightAddon, leftElement/rightElement, popoverPlacement, popoverStrategy, onBlur/onFocus, autoFocus, form, id, className. children is omitted; placeholder and triggerElement are re-declared as optional.
Component-specific and notable props:
| Prop | Type | Default | Description |
|---|---|---|---|
value |
string | null |
— (required) | Current value in HH:mm:ss format. |
onChange |
(value: string | null, event?) => void |
— (required) | Called with the new value: HH:mm:ss for a valid entry, the raw text when unparseable, or null when empty. |
name |
string |
— (required) | Field name. |
placeholder |
string |
— | Input placeholder. |
triggerElement |
ReactNode |
<Icon name="clock" size={20} /> |
Element rendered as the popover trigger. |
CustomTimePicker |
(props: { value: TimeString | null; onChange; onClose: () => void }) => ReactNode |
— | Render a custom picker body in the popover instead of the default TimePicker. |
H:mm (DISPLAY_TIME_FORMAT).HH:mm:ss (OUTPUT_TIME_FORMAT).ALLOWED_TIME_FORMAT (HH:mm, H:mm). A valid entry becomes HH:mm:ss; empty becomes null; anything else is passed through as raw text.ALLOWED_TIME_FORMAT (string[]), DISPLAY_TIME_FORMAT (string), and OUTPUT_TIME_FORMAT (string) are exported from @uxf/ui/time-picker-input.
isClearable, a clear button appears while the field has a value and is interactive; clearing sets the value to null.isDisabled / isReadOnly block interaction and prevent the popover from opening.isInvalid applies the error styling; pass helperText for the message.Client component ("use client").
This component ships no stylesheet of its own; import the styles of the parts it composes once in your global CSS:
@import url("@uxf/ui/css/input-with-popover.css");
@import url("@uxf/ui/css/time-picker.css");
@import url("@uxf/ui/css/calendar.css");
@import url("@uxf/ui/css/button.css");
@import url("@uxf/ui/css/icon.css");
Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.