Skip to content

[docs] Document how to chain in createTheme #21757

@dvh91

Description

@dvh91

When using createMuiTheme, along with overrides, we lose the context of the theme we customizing.
Here's a quick codesandbox which demonstrates the issue and also the desired (optional) solution:
https://codesandbox.io/s/jolly-aryabhata-8q37p

const theme = createMuiTheme({
  shape: {
    borderRadius: 4
  },
  overrides: {
    MuiChip: {
      root: {
        borderRadius: 4
      }
    }
  }
  // this is what I would want
  // overrides: (theme) => ({
  //   MuiChip: {
  //     root: {
  //       borderRadius: theme.shape.borderRadius
  //     }
  //   }
  // })
});
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to the documentation.ready to takeHelp wanted. Guidance available. There is a high chance the change will be acceptedscope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUI

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions