<TimeField
label="Label Text"
autoround={false}
defaultValue="09:00 AM"
disableSuggestions={false}
format="12"
max="05:00 PM"
min="09:00 AM"
step={30}
value="10:30 AM"
onChange={(change) => console.log(change)}
/>
TimeField Props
In addition to the props listed below, the TimeField accepts most TextField props with the exception of type, placeholder, showCounter and maxLength.If true, value will round to nearest future step. If there is a defined time
frame, the ceiling for rounding is the max time.
Uncontrolled initial value for the component.
If true, the dropdown with suggested time options is not present.
Time format for the component.
Maximum allowed time for a time frame. Must be paired with min. String must
match the format set for the component.
Minimum allowed time for a time frame. Must be paired with max. String must
match format set for the component.
onChange
(change: TimeFieldChange) => void
Callback fired on blur or after a time is selected from the selection list.
Time increments for the time suggestions and auto rounding.
Controlled value for the component.
// TimeFieldChange is returned by the onChange callback
const handleChange = (change: TimeFieldChange) => {
console.log(change.isInputEmpty, change.isInputValid, change.time);
};
TimeFieldChange Props
The onChange callback receives a TimeFieldChange object with the following properties:Whether the input is empty.
Whether there is a validation issue aside from empty value with the input.
The returned time string.