Skip to content

[grid] Remove 'column' and 'column-reverse' options from GridDirection type#47564

Merged
silviuaavram merged 34 commits into
mui:masterfrom
sai6855:grid-props
Apr 1, 2026
Merged

[grid] Remove 'column' and 'column-reverse' options from GridDirection type#47564
silviuaavram merged 34 commits into
mui:masterfrom
sai6855:grid-props

Conversation

@sai6855
Copy link
Copy Markdown
Member

@sai6855 sai6855 commented Jan 6, 2026

Try it here: https://stackblitz.com/edit/aytwvcfa?file=src%2FDemo.tsx

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
Copy Markdown

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%) ▼-7B(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 efb6b0b

@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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

sai6855 commented Jan 20, 2026

please check my comments

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

Comment on lines +56 to +63
<Grid container sx={{ justifyContent: 'flex-end' }} size={6}>
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'end' }}>
<Button onClick={handleClick('right-start')}>right-start</Button>
</Grid>
<Grid>

<Button onClick={handleClick('right')}>right</Button>
</Grid>
<Grid>

<Button onClick={handleClick('right-end')}>right-end</Button>
</Grid>
</Box>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is wrong, let's change the Grid to Stack instead.
x the others.

>
</Button>
<Grid container sx={{ alignItems: 'center' }}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think Grid container is not needed

Suggested change
<Grid container sx={{ alignItems: 'center' }}>

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 13, 2026
@ZeeshanTamboli
Copy link
Copy Markdown
Member

@sai6855 Can you resolve this first?

@sai6855
Copy link
Copy Markdown
Member Author

sai6855 commented Mar 1, 2026

I just went through changes again, does this change can be treated as breaking change? If yes, is it okay to move ahead with this PR?
https://github.com/mui/material-ui/pull/47564/changes#diff-52ea618a577700279275002787cece22d3b31be9e76fc946ba5e5cea360feb9aL13

@siriwatknp siriwatknp added the breaking change Introduces changes that are not backward compatible. label Mar 2, 2026
@siriwatknp
Copy link
Copy Markdown
Member

I just went through changes again, does this change can be treated as breaking change? If yes, is it okay to move ahead with this PR? https://github.com/mui/material-ui/pull/47564/changes#diff-52ea618a577700279275002787cece22d3b31be9e76fc946ba5e5cea360feb9aL13

Yes, it's fine as a breaking change

@siriwatknp
Copy link
Copy Markdown
Member

@sai6855 can you update this PR?

@silviuaavram
Copy link
Copy Markdown
Member

Since it's going to be a breaking change, it should also contain an entry in upgrade-to-v9.md

@sai6855
Copy link
Copy Markdown
Member Author

sai6855 commented Mar 31, 2026

Hey @siriwatknp @silviuaavram, really sorry for the delay here. I’m currently not able to work on this PR or mui PRs for few days, so please feel free to close it or someone else can continue from here.

@siriwatknp
Copy link
Copy Markdown
Member

Hey @siriwatknp @silviuaavram, really sorry for the delay here. I’m currently not able to work on this PR or mui PRs for few days, so please feel free to close it or someone else can continue from here.

No problem at all. @ZeeshanTamboli if you can take over this, let me know.

@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 31, 2026
@silviuaavram silviuaavram self-assigned this Mar 31, 2026
@silviuaavram
Copy link
Copy Markdown
Member

@ZeeshanTamboli @siriwatknp merged master and changed the docs examples. feel free to take a look.

Copy link
Copy Markdown
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.

LGTM! One minor nit: PositionedPopper.js has sx={{ alignItems: 'flex-start' }} on the left-side Stack but PositionedPopper.tsx doesn't — they should be consistent.

@silviuaavram
Copy link
Copy Markdown
Member

Yeah just noticed it via the pipeline, changed it. Thanks!

@silviuaavram silviuaavram merged commit 56f63bf into mui:master Apr 1, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. 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

6 participants