react-hook-form-bound time field. Wraps the @uxf/ui/time-picker-input primitive and manages its value, isInvalid, and helperText from form state.
Use @uxf/form/time-picker-input for a time-of-day field inside a @uxf/form form — it registers the field with react-hook-form via control/name and renders validation errors automatically. For a standalone, manually-controlled time input (outside a form), use the @uxf/ui/time-picker-input twin directly. For a combined date + time field use @uxf/form/datetime-picker-input.
import { Form } from "@uxf/form/form";
import { TimePickerInput, TimePickerInputValue } from "@uxf/form/time-picker-input";
import { useForm } from "react-hook-form";
interface FormData {
time: TimePickerInputValue;
}
function Example() {
const formApi = useForm<FormData>({ defaultValues: { time: null } });
return (
<Form formApi={formApi} id="example" onSubmit={(values) => console.log(values)}>
<TimePickerInput control={formApi.control} isClearable label="Time" name="time" placeholder="" />
</Form>
);
}
TimePickerInputValue = string | null — a time string in OUTPUT_TIME_FORMAT ("HH:mm:ss"), or null when empty. The input displays it as H:mm (DISPLAY_TIME_FORMAT); see the twin for parsing/display details.
TimePickerInputProps<FormData> = ControlProps<FormData> + the visual props of the @uxf/ui/time-picker-input twin (minus the ones this field manages: isFocused, isInvalid, max, min, name, onChange, pattern, step, value) + the field-specific props below.
| Prop | Type | Default | Description |
|---|---|---|---|
control |
Control<FormData> |
— | Required. The control from useForm. |
name |
FieldPath<FormData> |
— | Required. Field path in the form values. |
rules |
RegisterOptions |
— | Extra react-hook-form rules; merged with the built-in validation below. |
shouldUnregister |
boolean |
— | Unregister the field (drop its value) on unmount. |
isRequired |
boolean |
false |
Adds a required rule and the required indicator. |
requiredMessage |
string |
localized | Message for the required rule. |
CustomTimePicker |
(props: { value; onChange; onClose }) => ReactNode |
— | Render a custom picker body in the popover instead of the default one. |
onChange |
(value: string | null, event?) => void |
— | Called after the field value updates. |
All other props (label, placeholder, size, variant, helperText, isClearable, triggerElement, leftAddon/rightAddon/leftElement/rightElement, popoverPlacement/popoverStrategy, …) are forwarded to the twin — see @uxf/ui/time-picker-input. id defaults to `${formId}__${name}`.
Built-in rules (messages come from the uxf-form-time-picker-input:validation.* translations; override the required one with requiredMessage):
isRequired.HH:mm:ss, otherwise invalid-time-format (interpolates DISPLAY_TIME_FORMAT).rules; a function rules.validate is merged under the custom key. The field-level error is shown as the twin's helperText and sets isInvalid.Form — it reads the form context (formId, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.@uxf/ui/time-picker-input, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/time-picker-input.@uxf/ui/time-picker-input