Closed CharlineCouchot closed 9 months ago
@CharlineCouchot
const Typography = styled(T)()
const Parent = styled("div")( () => css` ${Child} { color: green; }
${Typography} {
color: blue;
}
`, );
- The emotion react supports emotion component nested selectors, so you just need to wrap customer React Element with it.
![image](https://github.com/mui/material-ui/assets/97073795/fbbd5d14-cdce-4af5-9750-302150688209)
That solved it! Thank you :) Would suggest maybe adding that to the Components Selector API documentation?
That solved it! Thank you :) Would suggest maybe adding that to the Components Selector API documentation?
I am not sure about that because styled function is powered by @emotion/styled
. Probably we can give it to owner .
Would suggest maybe adding that to the Components Selector API documentation?
Maybe not. The exported MUI components aren't wrapped with the styled
API, so it might not be necessary to add it to the Components Selector API documentation.
Duplicates
Summary
Following the documentation on the Components Selector API, using a regular styled component as a selector works but it is not possible to use MUI components as selectors.
Examples
https://codesandbox.io/p/devbox/peaceful-ptolemy-ytqqgt
Motivation
Maybe I'm doing something wrong, but with this approach, MUI components should behave the same way other styled components do IMO.
Search keywords: