Skip to contentSkip to content

PickersTextField API

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

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

Props of the native component are also available.

NameTypeDefaultDescription
areAllSectionsEmpty*bool-

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]

contentEditable*bool-

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

disabled*bool-
elements*Array<{ after: HTMLAttributes, before: HTMLAttributes, container: HTMLAttributes, content: {} }>-

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

error*boolfalse

If true, the input will indicate an error.

onBlur*func-
Signature:function(event: FocusEvent<HTMLDivElement, Element>) => void
    onChange*func-
    Signature:function(event: ChangeEvent<HTMLInputElement, Element>) => void
      onClick*func-
      Signature:function(event: MouseEvent<HTMLDivElement, MouseEvent>) => 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
                sectionListRef*ref-
                value*string-
                endAdornmentnode-

                End InputAdornment for this component.

                fullWidthboolfalse

                If true, the input will take up the full width of its container.

                helperTextnode-

                The helper text content.

                idstring-

                The id of the input element.

                inputRefref-

                Pass a ref to the input element.

                labelnode-

                The label content.

                namestring-

                Name attribute of the input element.

                readOnlybool-
                slotProps{}{}

                The props used for each component slot.

                slotsPickersTextFieldSlots{}

                The components used for each slot inside.

                See Slots API below for more details.

                startAdornmentnode-

                Start InputAdornment for this component.

                variant'filled'
                | 'outlined'
                | 'standard'
                'outlined'

                The variant to use.

                The ref is forwarded to the root element.

                Theme default props

                You can use MuiPickersTextField to change the default props of this component with the theme.

                Slots

                Slot nameClass nameDefault componentDescription
                formHelperTextFormHelperTextThe component used for the form helper text slot.
                htmlInputPickersInputBaseInputThe component rendered as the underlying hidden `` element.
                inputPickersOutlinedInputThe component used for the input slot. Defaults to one of `PickersInput`, `PickersFilledInput`, `PickersOutlinedInput` based on `variant`.
                inputLabelInputLabelThe component used for the input label slot.
                root.MuiPickersTextField-rootFormControlThe component used for the root slot.

                CSS classes

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

                Class nameRule nameDescription
                .Mui-disabledState class applied to the root element if `disabled=true`.
                .Mui-errorState class applied to the root element if `error=true`.
                .Mui-focusedStyles applied to the root element if focused.
                .Mui-requiredState class applied to the root element id `required=true`
                .MuiPickersTextField-rootrootStyles applied to the root element.

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

                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.