[英]Material UI, React and styling some, not all, components
I have a datatable that outputs something like this in React using material UI. 我有一个数据表,使用材料UI在React中输出类似的东西。
<button class="MuiButtonBase-root MuiTab-root MuiTab-textColorPrimary Mui-selected MuiTab-fullWidth" tabindex="0" type="button" role="tab" aria-selected="true">
<span class="MuiTab-wrapper">ASIC Notification</span>
<span class="MuiTouchRipple-root"></span>
</button>
Pretty standard output for Material UI content. Material UI内容的相当标准输出。 I am styling this material UI content by wrapping my app in this 我通过将我的应用程序包装在此来设置这个素材UI内容的样式
const theme = createMuiTheme({
MuiTab: {
textColorPrimary: {
color: "white !important" //White tab text color
},
'&$selected': {
color: "#182033 !important" //Dark tab text select color
}
}
}
This works and changes the styles as I want. 这可以根据需要改变样式。 However whenever I use the MUI Datatable import MUIDataTable from "mui-datatables";
但是每当我import MUIDataTable from "mui-datatables";
使用MUI Datatable import MUIDataTable from "mui-datatables";
They all share these classes and I need to style the second one different;y. 他们都分享这些课程,我需要设计第二个不同的风格; y。
How can I namespace a table so only that table is effected with certain styles? 如何命名表,以便只有该表受某些样式影响?
Thanks 谢谢
我想知道同样的事情,就不同的风格而言,Material UI为大多数组件提供了color
道具,可以切换组件的主题样式,但是没有明确的文档说明如何使用自己的主题颜色扩展这些API例如, primary
secondary
facebook
danger
你有什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.