亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

When using the <Tab/> component created by yourself, there is a problem with the "&.Mui-selected" state
P粉775788723
P粉775788723 2023-09-20 19:56:31
0
1
1137

I created a custom <Tab/> and I want to control its selection color by using the following code:

Sandbox Demo Code

export const Tab = styled(MuiTab)({
  "&.Mui-selected": {
    color: "red"
  }
});

However, I found:

1. Directly apply custom style components => The selected color is red

2.Wrapping custom style componentsin a self-created component => does not work, not even the default selected color

<Tabs value={value} variant="scrollable">
  <Tab label="Tab" value={1} /> //選中顏色 = 默認(rèn)值
  <TestTab label="TestTab" value={2} /> //選中顏色 = 默認(rèn)值(問題在這里)
  <Styled.Tab label="Styled.Tab" value={3} /> //選中顏色 = 紅色(好的,但我想包裝在自創(chuàng)建的組件中)
</Tabs>

Is this normal behavior that MUI does not recognize self-created Tabs?

P粉775788723
P粉775788723

reply all(1)
P粉946336138

How to create a wrapper component that renders your custom Tab component this way TestTab instead of using Styled.Tab

const TestTab = (props) => {
  return <Tab {...props} />;
};
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template