Skip to content

Add shouldForwardProp to theme #34831

@andrehil

Description

@andrehil

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I'm using a custom property to create custom variants for OutlinedInput.
The problem is that I need to pass the property to the component for the theme to have it, but the property ends up being rendered to the DOM.

Examples 🌈

Component usage:

<OutlinedInput state="error />

Theme:

{
  "MuiOutlinedInput":{
    "variants":[
      {
        "props":{
          "state":"error"
        },
        "style":{
          "my_custom_styles":"go here"
        }
      }
    ]
  }
}

Motivation 🔦

The motivation is the same as the function shouldForwardProp that exists in styled.
Avoid rendering unnecessary properties to DOM.

Metadata

Metadata

Labels

customization: themeHigher level theming customizability.duplicateThis issue or pull request already exists.scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: new featureExpand the scope of the product to solve a new problem.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions