mui / mui/material-ui

Variant for slot doesn't work

Open
#44,272 2 comments 0 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Oct 30, 2024.

customization: dom customization: theme scope: select type: bug
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Search keywords

variants, slots, props, evaluation

Latest version
  • I have tested the latest version
Steps to reproduce

Link to live example: https://stackblitz.com/edit/github-nynfvf?file=src%2Fthene.ts

Steps:

  1. Customize theme with components => MuiSelect => styleOverrides
  2. Define a variant for root and icon slots, both with props: props: { size: 'small' }
Current behavior

Variant for root is recognized and applied, for icon - it's not

Expected behavior

As far as I understand, also a variant for a slot should work.

Context

I tried for the icon a hardcoded props evaluation:

props: () => true

and it works. I also debugged size prop evaluation with:

props: ({ size }) => console.log(size)

and initially it has correct value small but immediately during next evaluation it's undefined What's surprising for me, it behaves exactly the same for root, but doesn't break variant's styling for root 🤔

Your environment

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.