Skip to content

[grid] Direction class names use array indexes and ignore custom breakpoints #49901

Backlog

Description

@PANJA-ABHISHEK

Steps to reproduce

import Grid from '@mui/material/Grid';

<Grid container direction={['column', 'row']} />

and, with custom breakpoints (mobile, tablet, …):

<Grid container direction="column" />

Current behavior

  • The responsive array gives the classes MuiGrid-direction-0-column and MuiGrid-direction-1-row: the array index is used instead of the breakpoint name.
  • With custom breakpoints, a single value always gives MuiGrid-direction-xs-column, although the theme has no xs breakpoint.

The styles are correct; only the class names are wrong.

Expected behavior

  • MuiGrid-direction-xs-column and MuiGrid-direction-sm-row, like the object form { xs: 'column', sm: 'row' }.
  • MuiGrid-direction-mobile-column, like the size (MuiGrid-grid-mobile-2) and spacing classes, which use the theme's smallest breakpoint.

Context

direction is passed to generateDirectionClasses() in packages/mui-system/src/Grid/gridGenerator.ts as is. That function maps any object with Object.entries() (so an array gives its indexes) and hard-codes xs for a single value. size and offset go through parseResponsiveProp(), and generateSpacingClassNames() receives theme.breakpoints.keys[0], so their classes use the theme breakpoints.

Your environment

@mui/material on master (a4f20c2).

Search keywords: grid direction class responsive array breakpoint

Search keywords:

Activity

  1. added
    status: waiting for maintainer
    on Nov 24, 2026
  2. added
    component: Grid
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: Gridstatus: waiting for maintainer

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions