Skip to content

Commit

Permalink
[docs] Improve Pickers name prop examples (#11422)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy committed Dec 18, 2023
1 parent 51d0059 commit 79f4bd6
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/data/date-pickers/date-picker/FormPropsDatePickers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { DatePicker } from '@mui/x-date-pickers/DatePicker';
export default function FormPropsDatePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['DatePicker', 'DatePicker']}>
<DemoContainer components={['DatePicker', 'DatePicker', 'DatePicker']}>
<DatePicker label="disabled" disabled />
<DatePicker label="readOnly" readOnly />
<DatePicker label="name" name="date_picker" />
<DatePicker label="name" name="startDate" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions docs/data/date-pickers/date-picker/FormPropsDatePickers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { DatePicker } from '@mui/x-date-pickers/DatePicker';
export default function FormPropsDatePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['DatePicker', 'DatePicker']}>
<DemoContainer components={['DatePicker', 'DatePicker', 'DatePicker']}>
<DatePicker label="disabled" disabled />
<DatePicker label="readOnly" readOnly />
<DatePicker label="name" name="date_picker" />
<DatePicker label="name" name="startDate" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<DatePicker label="disabled" disabled />
<DatePicker label="readOnly" readOnly />
<DatePicker label="name" name="date_picker" />
<DatePicker label="name" name="startDate" />
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export default function SingleInputDateRangePicker() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['SingleInputDateRangeField']}>
<DateRangePicker slots={{ field: SingleInputDateRangeField }} />
<DateRangePicker
slots={{ field: SingleInputDateRangeField }}
name="allowedRange"
/>
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export default function SingleInputDateRangePicker() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['SingleInputDateRangeField']}>
<DateRangePicker slots={{ field: SingleInputDateRangeField }} />
<DateRangePicker
slots={{ field: SingleInputDateRangeField }}
name="allowedRange"
/>
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<DateRangePicker slots={{ field: SingleInputDateRangeField }} />
<DateRangePicker
slots={{ field: SingleInputDateRangeField }}
name="allowedRange"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ This prop will be ignored on the mobile picker.

### Use a single input field

You can pass the `SingleInputDateRangeField` component to the Date Range Picker to use it for keyboard editing:
You can pass the `SingleInputDateRangeField` component to the Date Range Picker to use it for keyboard editing.
In such case the Picker component can pass the `name` prop to the input.

{{"demo": "SingleInputDateRangePicker.js"}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
export default function FormPropsDateTimePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['DateTimePicker', 'DateTimePicker']}>
<DemoContainer
components={['DateTimePicker', 'DateTimePicker', 'DateTimePicker']}
>
<DateTimePicker label="disabled" disabled />
<DateTimePicker label="readOnly" readOnly />
<DateTimePicker label="name" name="date_time_picker" />
<DateTimePicker label="name" name="startDateTime" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
export default function FormPropsDateTimePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['DateTimePicker', 'DateTimePicker']}>
<DemoContainer
components={['DateTimePicker', 'DateTimePicker', 'DateTimePicker']}
>
<DateTimePicker label="disabled" disabled />
<DateTimePicker label="readOnly" readOnly />
<DateTimePicker label="name" name="date_time_picker" />
<DateTimePicker label="name" name="startDateTime" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<DateTimePicker label="disabled" disabled />
<DateTimePicker label="readOnly" readOnly />
<DateTimePicker label="name" name="date_time_picker" />
<DateTimePicker label="name" name="startDateTime" />
4 changes: 2 additions & 2 deletions docs/data/date-pickers/time-picker/FormPropsTimePickers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
export default function FormPropsTimePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['TimePicker', 'TimePicker']}>
<DemoContainer components={['TimePicker', 'TimePicker', 'TimePicker']}>
<TimePicker label="disabled" disabled />
<TimePicker label="readOnly" readOnly />
<TimePicker label="name" name="time_picker" />
<TimePicker label="name" name="startTime" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions docs/data/date-pickers/time-picker/FormPropsTimePickers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
export default function FormPropsTimePickers() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer components={['TimePicker', 'TimePicker']}>
<DemoContainer components={['TimePicker', 'TimePicker', 'TimePicker']}>
<TimePicker label="disabled" disabled />
<TimePicker label="readOnly" readOnly />
<TimePicker label="name" name="time_picker" />
<TimePicker label="name" name="startTime" />
</DemoContainer>
</LocalizationProvider>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<TimePicker label="disabled" disabled />
<TimePicker label="readOnly" readOnly />
<TimePicker label="name" name="time_picker" />
<TimePicker label="name" name="startTime" />

0 comments on commit 79f4bd6

Please sign in to comment.