javascript - Material 用户界面 : Style nested components in TablePagination

标签 javascript reactjs material-ui

如何使用 TablePagination 组件的 actions 面板设置按钮样式?

import { withStyles } from '@material-ui/core';
import MuiTablePagination from '@material-ui/core/TablePagination';

const styles = {
  root: {
    color: 'rgba(0, 0, 0, 0.87)',
    backgroundColor: '#b1c4cd',
    display: 'flex',
    justifyContent: 'center',
    fontSize: '14px',
    width: '100%'
  },
  actions: {
    button: {
      color: 'yellow' // not working
    },
    MuiButtonBase: {
      color: 'yellow' // not working
    }
};

export const StyledTablePagination = withStyles(styles)(MuiTablePagination);

最佳答案

您可以简单地向 IconButton 本身添加样式:

const PaginationTheme = withStyles({
  actions:{
    color:'red'
  }
})(TablePagination);

这是所有 red buttons 的示例

您还可以使用按钮的类来更改其样式:

const PaginationTheme = withStyles({
  actions: {
    '& .MuiButtonBase-root:not([disabled])':{
      color: "red"
    }   
  }
})(TablePagination);

关于javascript - Material 用户界面 : Style nested components in TablePagination,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59577906/

相关文章:

javascript - 获取 `url` 的访问被 CORS 策略 : No 'Access-Control-Allow-Origin' header is present on the requested resource. ReactJS 阻止

javascript - 如何在路由功能之间共享变量?

javascript - 打开下拉菜单时如何更改 Material UI Select 组件(在轮廓模式下)的轮廓颜色(当前为蓝色)

javascript - ReactJS 中的 Bootstrap 行

javascript - Material Ui 代码在 codepen 中运行良好,但在 VSCODE 中运行不佳?

javascript - window.getSelection() 返回意外值

javascript - toLocaleDateString() - 挪威语问题

reactjs - 在 React JS 中缩小 .jsx 文件

reactjs - 更改 MUI 中的 Appbar 背景颜色

javascript - 在 Material UI react 中更改步骤时,垂直步进器应滚动到顶部