Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Custom breakpoints breaks other components #43806

Open
karolis-666 opened this issue Sep 18, 2024 · 0 comments
Open

[docs] Custom breakpoints breaks other components #43806

karolis-666 opened this issue Sep 18, 2024 · 0 comments
Assignees
Labels
docs Improvements or additions to the documentation status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page

Comments

@karolis-666
Copy link

karolis-666 commented Sep 18, 2024

Related page

https://mui.com/material-ui/customization/breakpoints/#custom-breakpoints

Kind of issue

Missing information

Issue description

Using custom breakpoints with module augmentation breaks other components, like Grid2 for example. When rendered it does not provide correct breakpoints.

image

So now if I provide <Grid2 size={{ xs: 12, md: 4 }}> it will throw TS error, but breakpoints are rendered correctly

When <Grid2 size={{ mobile: 12, laptop: 4 }}> is used, no TS error, but renders incorrectly.

Grid2 is just an example. This issue is visible with more components as well. Based on docs if I can rename breakpoints or use more of them as I want I expected other MUI components will be aware of this

Context

Example of breakpoints declaration

declare module '@mui/material/styles' {
  interface BreakpointOverrides {
    xs: false;
    sm: false;
    md: false;
    lg: false;
    xl: false;
    mobile: true;
    tablet: true;
    laptop: true;
    desktop: true;
  }
}

export const breakpoints = {
  values: {
    mobile: 0,
    tablet: 500,
    laptop: 1200, 
    desktop: 1400, 
  },
};

Example of createTheme

  const theme = useMemo(
    () =>
      responsiveFontSizes(
        createTheme({
          cssVariables: true,
          palette: {
            mode: themeMode,
            ...palette[themeMode],
          },
          shadows,
          ...breakpoints,
          ...components,
          ...typography,
          ...shape,
        }),
      ),
    [themeMode],
  );

Search keywords: breakpoints

@karolis-666 karolis-666 added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Sep 18, 2024
@karolis-666 karolis-666 changed the title [docs] [docs] Custom breakpoints breaks other components Sep 18, 2024
@zannager zannager added the docs Improvements or additions to the documentation label Sep 18, 2024
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 status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page
Projects
None yet
Development

No branches or pull requests

3 participants