Skip to content

styled with shouldForwardProp breaks forwarding of internal props #45014

@pushys

Description

@pushys

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/github-ljljbrse?file=src%2FApp.tsx
  2. Inspect the div node.

Current behavior

If you inspect the node, it has internal props such as as or sx forwarded directly to HTML.
image

Expected behavior

Internal props should not be forwarded to HTML nodes when shouldForwardProp is provided.

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: styled, shouldForwardProp

Metadata

Metadata

Assignees

Labels

scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: expected behaviorThe current behavior is already the one expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions