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

Expose theme for mixins #44213

Open
o-alexandrov opened this issue Oct 25, 2024 · 0 comments
Open

Expose theme for mixins #44213

o-alexandrov opened this issue Oct 25, 2024 · 0 comments
Assignees
Labels
customization: theme Centered around the theming features new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@o-alexandrov
Copy link
Contributor

o-alexandrov commented Oct 25, 2024

Summary

There are 2 problems:

  1. Currently mixins type is part of ThemeOptions in:

export interface ThemeOptions extends Omit<SystemThemeOptions, 'zIndex'>, CssVarsOptions {

It's a duplicate as mixins already exists in:

  1. mixins expects an object; it should also allow to pass a function (theme) => mixins
    • currently, when using with CSS variables, you don't have access to the MUI CSS variables' names. i.e. I can't define theme.vars.palette-dependent styles in mixins, because there's no built-in way to access them

Motivation

Similar to components[COMPONENT_NAME].styleOverrides.root, It should be possible to set:

mixins: ({ theme }) => ({
  myExampleMixin: {
    border: `1px solid ${theme.vars.palette.primary.main`,
    // ...myOtherStyles
  }
})

Search keywords: theme, mixins

@o-alexandrov o-alexandrov added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 25, 2024
@mj12albert mj12albert added customization: theme Centered around the theming features new feature New feature or request labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization: theme Centered around the theming features new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants