Time Field
A Time Field takes a time typed in segments — hour, minute, and the period where the locale uses one. It reads and writes a time value rather than a string, so a schedule or a reminder gets a value it can compare and store.
Rendered live, with the same build of the library you install.
Starts at
930AM
24-hour
0930
TimeField.tsx
import { useState } from 'react';import { Time } from '@internationalized/date';import { NTimeField } from '@nayan-ui/react';const TimeField = () => {const [value, setValue] = useState<any>(new Time(9, 30));return (<div><div className="max-w-sm"><NTimeField label="Starts at" value={value} onChange={setValue} /><NTimeField label="24-hour" value={value} onChange={setValue} hourCycle={24} /></div></div>);};export default TimeField;
| Name | Type | Default | Details |
|---|---|---|---|
| value | any | Optional | The value prop. |
| defaultValue | any | Optional | The defaultValue prop. |
| onChange | (value: any) => void | Optional | The onChange prop. |
| label | ReactNode | Optional | The label prop. |
| minValue | any | Optional | The minValue prop. |
| maxValue | any | Optional | The maxValue prop. |
| granularity | 'hour' | 'minute' | 'second' | 'minute' | The granularity prop. |
| hourCycle | 12 | 24 | Optional | 12- or 24-hour display. Defaults to the locale's own convention. |
| disabled | boolean | false | The disabled prop. |
| isInvalid | boolean | false | The isInvalid prop. |
| variant | 'primary' | 'secondary' | 'primary' | The variant prop. |
| fullWidth | boolean | false | The fullWidth prop. |
| error | ReactNode | Optional | The error prop. |
| helperText | ReactNode | Optional | The helperText prop. |
| className | string | '' | The className prop. |
| labelClassName | string | '' | The labelClassName prop. |
| aria-label | string | 'Time' | The aria-label prop. |
Other components solving nearby problems.