SingleInputTimeRangeField API
API reference docs for the React SingleInputTimeRangeField component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { SingleInputTimeRangeField } from '@mui/x-date-pickers-pro/SingleInputTimeRangeField';
// or
import { SingleInputTimeRangeField } from '@mui/x-date-pickers-pro';Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| ampm | bool | adapter.is12HourCycleInCurrentLocale() | 12h/24h view for hour selection clock. |
| areAllSectionsEmpty | bool | - | Is |
| autoFocus | bool | false | If |
| clearable | bool | false | If |
| clearButtonPosition | 'end' | 'start' | 'end' | The position at which the clear button is placed. If the field is not clearable, the button is not rendered. |
| dateSeparator | string | "–" | String displayed between the start and the end dates. |
| defaultValue | PickerRangeValue | - | The default value. Use when the component is not controlled. |
| disabled | bool | false | If |
| disableFuture | bool | false | If |
| disableIgnoringDatePartForTimeValidation | bool | false | Do not ignore date part when validating min/max time. |
| disablePast | bool | false | If |
| endAdornment | node | - | End |
| error | bool | false | If |
| fieldRef | {} | - | The ref object used to imperatively interact with the field. |
| focused | bool | - | If |
| format | string | - | Format of the date when rendered in the input(s). |
| formatDensity | 'dense' | 'spacious' | "dense" | Density of the format when rendered in the input.
Setting |
| fullWidth | bool | false | If |
| helperText | node | - | The helper text content. |
| id | string | - | The id of the |
| inputRef | ref | - | Pass a ref to the |
| label | node | - | The label content. |
| maxTime | {} | - | Maximal selectable time.
The date part of the object will be ignored unless |
| minTime | {} | - | Minimal selectable time.
The date part of the object will be ignored unless |
| minutesStep | number | 1 | Step over minutes. |
| name | string | - | Name attribute of the |
| onBlur | func | - | Signature: function(event: FocusEvent<HTMLDivElement, Element>) => void |
| onChange | func | - | Callback fired when the value changes. Signature: function(value: TValue, context: FieldChangeHandlerContext<TError>) => void
|
| onClear | func | - | Callback fired when the clear button is clicked. Signature: function(event: MouseEvent<Element, MouseEvent>) => void |
| onClick | func | - | Signature: function(event: MouseEvent<HTMLDivElement, MouseEvent>) => void |
| onError | func | - | Callback fired when the error associated with the current value changes.
When a validation error is detected, the Signature: function(error: TError, value: TValue) => void
|
| onFocus | func | - | Signature: function(event: FocusEvent<HTMLDivElement, Element>) => void |
| onInput | func | - | Signature: function(event: FormEvent<HTMLDivElement>) => void |
| onKeyDown | func | - | Signature: function(event: MuiEvent<KeyboardEvent<HTMLDivElement>>) => void |
| onPaste | func | - | Signature: function(event: ClipboardEvent<HTMLDivElement>) => void |
| onSelectedSectionsChange | func | - | Callback fired when the selected sections change. Signature: function(newValue: FieldSelectedSections) => void
|
| openPickerButtonPosition | 'end' | 'start' | 'end' | The position at which the opening button is placed. If there is no Picker to open, the button is not rendered |
| readOnly | bool | false | If |
| referenceDate | {} | The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used. | The date used to generate a part of the new value that is not present in the format when both |
| selectedSections | 'all' | 'day' | 'empty' | 'hours' | 'meridiem' | 'minutes' | 'month' | 'seconds' | 'weekDay' | 'year' | number | - | The currently selected sections.
This prop accepts four formats:
1. If a number is provided, the section at this index will be selected.
2. If a string of type |
| shouldDisableTime | func | - | Disable specific time. Signature: function(value: PickerValidDate, view: TimeView) => boolean
|
| shouldRespectLeadingZeros | bool | false | If |
| slotProps | SingleInputTimeRangeFieldSlotProps | {} | The props used for each component slot. |
| slots | SingleInputTimeRangeFieldSlots | {} | Overridable component slots. See Slots API below for more details. |
| startAdornment | node | - | Start |
| timezone | string | The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise. | Choose which timezone to use for the value. Example: "default", "system", "UTC", "America/New_York". If you pass values from other timezones to some props, they will be converted to this timezone before being used. See timezones documentation for more details. |
| value | PickerRangeValue | - | The selected value. Used when the component is controlled. |
| variant | 'filled' | 'outlined' | 'standard' | 'outlined' | The variant to use. |
ref is forwarded to the root element.Theme default props
You can use MuiSingleInputTimeRangeField to change the default props of this component with the theme.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| clearButton | IconButton | Button to clear the value. | |
| clearIcon | ClearIcon | Icon to display in the button used to clean the value. | |
| inputAdornment | InputAdornment | Component displayed on the start or end input adornment used to open the Picker. | |
| textField | <PickersTextField /> | Form control with an input to render the value. |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.