# Input Time

The InputTime component is a text input that allows the user to enter a time
value.

## Design & usage guidelines

This component obeys the system locale settings to determine 24 or 12 hour time.

### States

A
[disabled](/storybook/web/?path=/story/components-forms-and-inputs-inputtime--disabled)
state will be visually muted and the input will not be editable. This is similar
to the
[read-only](/storybook/web/?path=/story/components-forms-and-inputs-inputtime--read-only)
state, but the input is not muted.

An
[invalid](/storybook/web/?path=/story/components-forms-and-inputs-inputtime--invalid)
state will indicate that the input is not valid. This can be used when the input
is required and the user has not entered a value.


## Controlled & Uncontrolled

### Controlled component

Web's
[Controlled](/storybook/web/?path=/story/components-forms-and-inputs-inputtime--controlled)
version includes a type-ahead feature where typing at least 1 number
automatically fills in the rest of the time. For example, typing `2` will fill
in `2:00 PM` and typing `1` waits for a few milliseconds in case the user wants
to type `10`, `11`, or `12`.


## Props

### Web

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `align` | `"center" | "right"` | No | — | Determines the alignment of the text inside the input. |
| `autocomplete` | `boolean | AutocompleteTypes` | No | — | Determines if browser form autocomplete is enabled. Note that "one-time-code" is experimental and should not be used ... |
| `clearable` | `Clearable` | No | — | Add a clear action on the input that clears the value.  You should always use `while-editing` if you want the input t... |
| `defaultValue` | `Date` | No | — | Intial value of the input. Only use this when you need to prepopulate the field with a data that is not controlled by... |
| `description` | `ReactNode` | No | — | Further description of the input, can be used for a hint. |
| `disabled` | `boolean` | No | — | Disable the input |
| `id` | `string` | No | — | A unique identifier for the input. |
| `inline` | `boolean` | No | — | Adjusts the form field to go inline with a content. This also silences the given `validations` prop. You'd have to us... |
| `inputRef` | `RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>` | No | — |  |
| `invalid` | `boolean` | No | — | Highlights the field red to indicate an error. |
| `loading` | `boolean` | No | — | Show a spinner to indicate loading |
| `max` | `number` | No | — | Specifies the maximum numerical or date value that a user can type |
| `maxLength` | `number` | No | — | Maximum character length for an input. This also changes the width to roughly the same size as the max length. This i... |
| `min` | `number` | No | — | Specifies the minimum numerical or date value that a user can type |
| `name` | `string` | No | — | Name of the input. |
| `onBlur` | `(event?: FocusEvent<Element, Element>) => void` | No | — | Blur callback. |
| `onChange` | `(newValue?: Date) => void` | No | — | Function called when user changes input value. |
| `onEnter` | `(event: KeyboardEvent<Element>) => void` | No | — | A callback to handle "Enter" keypress. This will only run if Enter is the only key. Will not run if Shift or Control ... |
| `onFocus` | `(event?: FocusEvent<Element, Element>) => void` | No | — | Focus callback. |
| `onValidation` | `(message: string) => void` | No | — | Callback to get the the status and message when validating a field @param message |
| `placeholder` | `string` | No | — | Text that appears inside the input when empty and floats above the value as a mini label once the user enters a value... |
| `readonly` | `boolean` | No | — | Prevents users from editing the value. |
| `size` | `"small" | "large"` | No | — | Adjusts the interface to either have small or large spacing. |
| `validations` | `RegisterOptions` | No | — | Show an error message above the field. This also highlights the the field red if an error message shows up. |
| `value` | `Date` | No | — | Set the component to the given value. |
