Skip to content

TimeField

Types a time of day segment by segment.

Opening time
0930
TimeField.tsx
import {TimeField} from 'alinea/components'

export function TimeFieldExample() {
  return (
    <TimeField
      label="Opening time"
      defaultValue="09:30"
      hourCycle={24}
      style={{width: 180}}
    />
  )
}

Props

PropTypeDefaultDescription
localestring; /** The time, `HH:mm` or `HH:mm:ss` */ value?: string | null; defaultValue?: string | null; /** Receives `HH:mm`, or `HH:mm:ss` when granularity is `second` */ onValueChange?: (value: string | null) => void; /** The earliest valid time, `HH:mm` or `HH:mm:ss` */ min?: string; /** The latest valid time, `HH:mm` or `HH:mm:ss` */ max?: string; /** The smallest unit that can be edited, defaults to `minute` */ granularity?: 'minute' | 'second'; /** Defaults to the locale's hour cycle */ hourCycle?: 12 | 24Default –BCP 47 locale used to format dates, eg. en-GB, defaults to the user's locale
namestringDefault –
autoFocusbooleanDefault –
labelReactNodeDefault –
descriptionReactNodeDefault –
errorReactNodeDefault –
requiredbooleanDefault –
disabledbooleanDefault –
readOnlybooleanDefault –
iconIconType | ReactElementDefault –
sharedbooleanDefault –Marks the field as shared between translations

Also accepts className and style, id and aria-* labelling attributes and data-* attributes.