Skip to content

PickersTextField API

API reference docs for the React PickersTextField component. Learn about the props, CSS, and other APIs of this exported module.

Component demos

Import

import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
// or
import { PickersTextField } from '@mui/x-date-pickers';
// or
import { PickersTextField } from '@mui/x-date-pickers-pro';
Learn about the difference by reading this guide on minimizing bundle size.

Props

areAllSectionsEmptyRequired

Is true if the current values equals the empty value. For a single item value, it means that value === null For a range value, it means that value === [null, null]

Type:bool


contentEditableRequired

If true, the whole element is editable. Useful when all the sections are selected.

Type:bool


elementsRequired

The elements to render. Each element contains the prop to edit a section of the value.

Type:Array<{ after: object, before: object, container: object, content: object }>


color

The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide.

Type:'error'
| 'info'
| 'primary'
| 'secondary'
| 'success'
| 'warning'

Default:'primary'


focused

If true, the component is displayed in focused state.

Type:bool


helperText

The helper text content.

Type:node


hiddenLabel

If true, the label is hidden. This is used to increase density for a FilledInput. Be sure to add aria-label to the input element.

Type:bool

Default:false


InputProps

Props applied to the Input element. It will be a FilledInput, OutlinedInput or Input component depending on the variant prop value.

Type:object


margin

If dense or normal, will adjust vertical spacing of this and contained components.

Type:'dense'
| 'none'
| 'normal'

Default:'none'


required

If true, the label will indicate that the input is required.

Type:bool

Default:false


size

The size of the component.

Type:'medium'
| 'small'

Default:'medium'


sx

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

Type:Array<func
| object
| bool>
| func
| object


variant

The variant to use.

Type:'filled'
| 'outlined'
| 'standard'

Default:'outlined'


The component cannot hold a ref.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.MuiPickersTextField-fullWidth

Styles applied to the root element if fullWidth={true}.

Rule name:fullWidth


.MuiPickersTextField-marginDense

Styles applied to the root element if margin="dense".

Rule name:marginDense


.MuiPickersTextField-marginNormal

Styles applied to the root element if margin="normal".

Rule name:marginNormal


.MuiPickersTextField-root

Styles applied to the root element.

Rule name:root



You can override the style of the component using one of these customization options: