Skip to content

Commit 36442b0

Browse files
Fix demo
1 parent 4058d3e commit 36442b0

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

docs/data/date-pickers/custom-opening-button/AddWarningIconWhenInvalidRange.js

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
77
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
88
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
99

10+
import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro';
11+
1012
function CustomInputAdornment(props) {
1113
const { hasError, children, sx, ...other } = props;
1214
return (
@@ -39,6 +41,7 @@ export default function AddWarningIconWhenInvalidRange() {
3941
maxDate={dayjs('2022-04-19')}
4042
defaultValue={[dayjs('2022-04-18'), dayjs('2022-04-21')]}
4143
onError={setError}
44+
slots={{ field: MultiInputDateRangeField }}
4245
slotProps={{
4346
textField: (ownerState) => ({
4447
InputProps: {

docs/data/date-pickers/custom-opening-button/AddWarningIconWhenInvalidRange.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
77
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
88
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
99
import { DateRangeValidationError } from '@mui/x-date-pickers-pro/models';
10+
import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro';
1011

1112
function CustomInputAdornment(props: InputAdornmentProps & { hasError?: boolean }) {
1213
const { hasError, children, sx, ...other } = props;
@@ -40,6 +41,7 @@ export default function AddWarningIconWhenInvalidRange() {
4041
maxDate={dayjs('2022-04-19')}
4142
defaultValue={[dayjs('2022-04-18'), dayjs('2022-04-21')]}
4243
onError={setError}
44+
slots={{ field: MultiInputDateRangeField }}
4345
slotProps={{
4446
textField: (ownerState) => ({
4547
InputProps: {

docs/data/date-pickers/custom-opening-button/custom-opening-button.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ In the example below, the warning icon will be visible anytime the current value
5252

5353
{{"demo": "AddWarningIconWhenInvalid.js"}}
5454

55-
To add the same behavior to a picker that do not have an input adornment (for example Date Range Picker),
55+
To add the same behavior to a picker that do not have an input adornment (for example Date Range Picker when used with a multi input field),
5656
you need to use the `textField` slot to add one:
5757

5858
{{"demo": "AddWarningIconWhenInvalidRange.js"}}

packages/x-date-pickers/src/internals/demo/DemoContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function DemoContainer(props: DemoGridProps) {
169169
minWidth: {
170170
xs: 300,
171171
// If demo also contains MultiInputDateTimeRangeField, increase width to avoid cutting off the value.
172-
md: childrenTypes.has('multi-input-range-field') ? 460 : 400,
172+
md: childrenTypes.has('multi-input-range-field') ? 460 : 440,
173173
},
174174
},
175175
};

0 commit comments

Comments
 (0)