Skip to content

Conversation

AmrElnaggar99
Copy link
Contributor

Fix incorrect parameter name in date pickers custom components documentation from variant to pickerVariant

Problem

The documentation in docs/data/date-pickers/custom-components/custom-components.md shows an incorrect parameter name in the actionBar slotProps example. The example uses variant but the actual PickerOwnerState interface defines the property as pickerVariant.

Current (incorrect) documentation:

actionBar: ({ variant }) => ({
      actions: variant === 'desktop' ? [] : ['clear'],
    }),

Source: https://mui.com/x/react-date-pickers/custom-components/#component-props

Actual interface definition:

export interface PickerOwnerState {
  pickerVariant: PickerVariant;
  // ... other properties
}

Source: https://github.com/mui/mui-x/blob/master/packages/x-date-pickers/src/models/pickers.ts#L56

Solution

Update the documentation example to use the correct parameter name pickerVariant instead of variant.

Fixed documentation:

actionBar: ({ pickerVariant }) => ({
      actions: pickerVariant === 'desktop' ? [] : ['clear'],
    }),

Impact

This fix ensures developers using the slotProps API get the correct parameter name, preventing runtime/linter errors and improving developer experience.

@mui-bot
Copy link

mui-bot commented Jul 26, 2025

Deploy preview: https://deploy-preview-18919--material-ui-x.netlify.app/

Updated pages:

Bundle size report

Bundle Parsed Size Gzip Size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid/DataGrid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro/DataGridPro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium/DataGridPremium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 8634922

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contributions!

@flaviendelangle flaviendelangle added docs Improvements or additions to the documentation. scope: pickers Changes related to the date/time pickers. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Jul 28, 2025
@flaviendelangle flaviendelangle enabled auto-merge (squash) July 28, 2025 09:05
@flaviendelangle flaviendelangle changed the title Fix incorrect parameter name in date pickers custom components documentation from variant to pickerVariant [docs] Fix incorrect parameter name in date pickers custom components documentation from variant to pickerVariant Jul 28, 2025
@flaviendelangle flaviendelangle merged commit 3f65571 into mui:master Jul 28, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation. scope: pickers Changes related to the date/time pickers. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants