[英]Material UI - Tab icon Styles
我正在动态使用此选项卡:
<Tabs
value={value}
onChange={handleChange}
variant="scrollable"
scrollButtons="off"
indicatorColor="primary"
textColor="primary"
aria-label="scrollable"
classes={{
indicator: classes.indicator,
flexContainer: classes.flexContainer,
}}
>
{routes.map((value, index) => (
<Tab
classes={{
root: classes.tabRoot,
wrapper: classes.wrapper,
labelIcon: classes.labelIcon,
selected: classes.selected,
}}
key={index}
label={strings(value)}
icon={getIcon(value)}
{...a11yProps(index)}
/>
))}
{<Grid container>
<Grid item xs>
<PrintButton
type= "widget"
params={queryParams}
style={{
textTransform: "capitalize",
float: "right"
}}
/>
</Grid>
</Grid>}
</Tabs>
这是 getIcon 函数:
const getIcon = (value) => {
if (value === eventType.view) return <PageviewIcon />;
if (value === eventType.lead) return <ContactsIcon />;
if (value === eventType.share) return <ShareIcon />;
if (value === eventType.follow) return <GroupAddIcon />;
if (value === eventType.media) return <PermMediaIcon />;
if (value === eventType.print) return <FindInPageIcon />;
return null;
};
但我无法找到一种方法来替换这个类MuiTab-labelIcon .MuiTab-wrapper默认情况下是这样的:
在更新到 Material UI v4 之前我没有遇到这个问题
<ShareIcon style={{paddingBottom: '0px', paddingRight: "10px"}}/>
我将不胜感激任何帮助,提前致谢!!
用父组件包裹 Text 和 Icon 并应用
style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', justifyContent: 'center' }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.