DigitalClock API
API reference docs for the React DigitalClock component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { DigitalClock } from '@mui/x-date-pickers/DigitalClock';
// or
import { DigitalClock } from '@mui/x-date-pickers';
// or
import { DigitalClock } 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 | utils.is12HourCycleInCurrentLocale() | 12h/24h view for hour selection clock. |
autoFocus | bool | - | If |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
defaultValue | object | - | The default selected value. Used 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 |
focusedView | 'hours' | - | Controlled focused view. |
maxTime | object | - | Maximal selectable time. The date part of the object will be ignored unless |
minTime | object | - | Minimal selectable time. The date part of the object will be ignored unless |
minutesStep | number | 1 | Step over minutes. |
onChange | func | - | Callback fired when the value changes. Signature: function(value: TValue, selectionState: PickerSelectionState | undefined, selectedView: TView | undefined) => void
|
onFocusedViewChange | func | - | Callback fired on focused view change. Signature: function(view: TView, hasFocus: boolean) => void
|
onViewChange | func | - | Callback fired on view change. Signature: function(view: TView) => void
|
openTo | 'hours' | - | The default visible view. Used when the component view is not controlled. Must be a valid option from |
readOnly | bool | false | If |
referenceDate | object | The closest valid time using the validation props, except callbacks such as `shouldDisableTime`. | The date used to generate the new value when both |
shouldDisableTime | func | - | Disable specific time. Signature: function(value: TDate, view: TimeView) => boolean
Returns: If |
skipDisabled | bool | false | If |
slotProps | object | {} | The props used for each component slot. |
slots | object | {} | Overrideable component slots. See Slots API below for more details. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
timeStep | number | 30 | The time steps between two time options. For example, if |
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 the timezones documentation for more details. |
value | object | - | The selected value. Used when the component is controlled. |
view | 'hours' | - | The visible view. Used when the component view is controlled. Must be a valid option from |
views | Array<'hours'> | ['hours'] | Available views. |
ref
is forwarded to the root element.Theme default props
You can use MuiDigitalClock
to change the default props of this component with the theme.
Slot name | Class name | Default component | Description |
---|---|---|---|
digitalClockItem | MenuItem from '@mui/material' | Component responsible for rendering a single digital clock item. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiDigitalClock-item | item | Styles applied to the list item (by default: MenuItem) element. |
.MuiDigitalClock-list | list | Styles applied to the list (by default: MenuList) element. |
.MuiDigitalClock-root | root | Styles applied to the root element. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.