Skip to content

Conversation

@sai6855
Copy link
Member

@sai6855 sai6855 commented Jan 6, 2026

closes #47563

According to https://mui.com/material-ui/react-grid/#column-direction, direction prop doesn't support column and column-reverse but api-docs page listed them as valid . This PR fixes discrepancy

preview: https://deploy-preview-47564--material-ui.netlify.app/material-ui/api/grid/

Copilot AI review requested due to automatic review settings January 6, 2026 06:49
@sai6855 sai6855 changed the title [grid] Remove 'column' and 'column-reverse' options from GridDirectio… [grid] Remove 'column' and 'column-reverse' options from GridDirection type Jan 6, 2026
@mui-bot
Copy link

mui-bot commented Jan 6, 2026

Netlify deploy preview

https://deploy-preview-47564--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-26B(-0.01%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against c75bef7

@sai6855 sai6855 added type: bug It doesn't behave as expected. docs Improvements or additions to the documentation. component: Grid The React component. labels Jan 6, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes 'column' and 'column-reverse' options from the GridDirection type definition, limiting it to only 'row' and 'row-reverse' values.

  • Changes the exported GridDirection type to exclude column-based flex-direction values
  • Represents a breaking change to the Grid component's TypeScript API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };

export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
export type GridDirection = 'row' | 'row-reverse';
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

This is a breaking API change that removes valid CSS flex-direction values ('column' and 'column-reverse') from the GridDirection type. This will cause TypeScript compilation errors for any existing code using these direction values. If this is intentional, it should be:

  1. Documented as a breaking change
  2. Include a migration guide explaining why these values are being removed and what alternatives users should use
  3. Consider deprecating these values first in a minor release before removing them in a major version

If there's a technical reason why column directions shouldn't be supported in Grid, that rationale should be documented.

Suggested change
export type GridDirection = 'row' | 'row-reverse';
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';

Copilot uses AI. Check for mistakes.
type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };

export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
export type GridDirection = 'row' | 'row-reverse';
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The GridDirection type is being updated to remove 'column' and 'column-reverse' values, but this change is incomplete. Several other parts of the codebase still reference these values and need to be updated:

  1. PropTypes validation (lines 181-182 in this file) still accepts 'column' and 'column-reverse'
  2. The DIRECTIONS constant in gridClasses.ts (line 18) still includes all four values
  3. The underlying @mui/system/Grid/GridProps.ts still defines GridDirection with all four values
  4. PigmentGrid also has the full set of direction values

This incomplete change will cause inconsistencies between TypeScript type checking and runtime behavior, and may break applications that use column directions. Consider either completing all related changes together or reverting this change until a comprehensive update can be made.

Suggested change
export type GridDirection = 'row' | 'row-reverse';
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed 👍

@sai6855 sai6855 requested a review from siriwatknp January 6, 2026 09:57
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@sai6855 As stated by Co-pilot in this comment, I think you need to remove from gridClasses and MUI System GridProps as well.

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@sai6855
Copy link
Member Author

sai6855 commented Jan 12, 2026

The layout is broken in:

it's fixed can you check now, Since argos didn't reported any errors i thought demos were functional

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

I think we need to update the docs here https://deploy-preview-47564--material-ui.netlify.app/material-ui/api/grid/#grid-prop-direction.

It says flex-direction, but now it doesn't include column and column-reverse. We can update it to:

/**
 * Defines the `flex-direction` style property for the container.
 *
 * ⚠️ Only `row` and `row-reverse` are supported. `column` and `column-reverse` are not supported,
 * because the Grid component is designed to subdivide layouts into **columns**, not rows.
 *
 * For vertical layouts, use `Stack` (optionally inside a Grid item).
 *
 * @default 'row'
 */

@ZeeshanTamboli
Copy link
Member

@sai6855 If it looks good, you can merge this.

@sai6855
Copy link
Member Author

sai6855 commented Jan 13, 2026

@sai6855 If it looks good, you can merge this.

Since this has critical changes, i requested additional review from @siriwatknp to avoid regressions

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

please check my comments

Comment on lines 37 to 54
<Grid container sx={{ justifyContent: 'flex-end' }} size={6}>
<Stack sx={{ alignItems: 'end' }}>
<Grid>
<Tooltip title="Add" placement="right-start">
<Button variant="plain">right-start</Button>
</Tooltip>
</Grid>
<Grid>
<Tooltip title="Add" placement="right">
<Button variant="plain">right</Button>
</Tooltip>
</Grid>
<Grid>
<Tooltip title="Add" placement="right-end">
<Button variant="plain">right-end</Button>
</Tooltip>
</Grid>
</Stack>
Copy link
Member

Choose a reason for hiding this comment

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

This is strange. It looks misuse to me, I think better to change entirely to Stack or Box with sx prop.

Comment on lines 290 to 301
- PaperComponent={CustomPaperComponent}
- PopperComponent={CustomPopperComponent}
- ListboxComponent={CustomListboxComponent}
+ slots={{
+ paper: CustomPaperComponent,
+ popper: CustomPopperComponent,
+ }}
+ slotProps={{
+ listbox: {
+ component: CustomListboxComponent,
+ },
+ }}
Copy link
Member

Choose a reason for hiding this comment

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

this file is not related to the PR.

},
"direction": {
"description": "Defines the <code>flex-direction</code> style property. It is applied for all screen sizes."
"description": "Defines the <code>flex-direction</code> style property for the container.<br>⚠️ Only <code>row</code> and <code>row-reverse</code> are supported. <code>column</code> and <code>column-reverse</code> are not supported, because the Grid component is designed to subdivide layouts into <strong>columns</strong>, not rows.<br>For vertical layouts, use <code>Stack</code> (optionally inside a Grid item)."
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"description": "Defines the <code>flex-direction</code> style property for the container.<br>⚠️ Only <code>row</code> and <code>row-reverse</code> are supported. <code>column</code> and <code>column-reverse</code> are not supported, because the Grid component is designed to subdivide layouts into <strong>columns</strong>, not rows.<br>For vertical layouts, use <code>Stack</code> (optionally inside a Grid item)."
"description": "Defines the <code>flex-direction</code> style property for the container.<br>⚠️ Only <code>row</code> and <code>row-reverse</code> are supported. <code>column</code> and <code>column-reverse</code> are not supported, because the Grid component is designed to subdivide layouts into <strong>columns</strong>, not rows.<br>For vertical layouts, use <code>Stack</code> instead."

I think we should not tell users to mix the Grid and Stack together. They serve a different purpose for creating layout.

Copy link
Member

Choose a reason for hiding this comment

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

Just to be clear, I meant using Stack as a child of Grid container is misuse but this demo is fine:
https://mui.com/material-ui/react-grid/#column-direction

@sai6855
Copy link
Member Author

sai6855 commented Jan 20, 2026

please check my comments

@siriwatknp applied suggestion as per your review, can you re-check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: Grid The React component. docs Improvements or additions to the documentation. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs][grid] Incorrect direction prop description

4 participants