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 of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| areAllSectionsEmpty* | bool | - | Is |
| contentEditable* | bool | - | If true, the whole element is editable. Useful when all the sections are selected. |
| disabled* | bool | - | |
| elements* | Array<{ after: HTMLAttributes | - | The elements to render. Each element contains the prop to edit a section of the value. |
| error* | bool | false | If |
| 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 | - | |
| endAdornment | node | - | End |
| 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. |
| name | string | - | Name attribute of the |
| readOnly | bool | - | |
| slotProps | {} | {} | The props used for each component slot. |
| slots | PickersTextFieldSlots | {} | The components used for each slot inside. See Slots API below for more details. |
| startAdornment | node | - | Start |
| variant | 'filled' | 'outlined' | 'standard' | 'outlined' | The variant to use. |
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.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| formHelperText | FormHelperText | The component used for the form helper text slot. | |
| htmlInput | PickersInputBaseInput | The component rendered as the underlying hidden `` element. | |
| input | PickersOutlinedInput | The component used for the input slot. Defaults to one of `PickersInput`, `PickersFilledInput`, `PickersOutlinedInput` based on `variant`. | |
| inputLabel | InputLabel | The component used for the input label slot. | |
| root | .MuiPickersTextField-root | FormControl | The component used for the root slot. |
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 |
|---|---|---|
| .Mui-disabled | State class applied to the root element if `disabled=true`. | |
| .Mui-error | State class applied to the root element if `error=true`. | |
| .Mui-focused | Styles applied to the root element if focused. | |
| .Mui-required | State class applied to the root element id `required=true` | |
| .MuiPickersTextField-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
styleOverridesproperty in a custom theme.
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.