【问题标题】:Material ui custom scrollbar材质ui自定义滚动条
【发布时间】:2022-02-08 18:21:38
【问题描述】:

如何在材质ui中添加自定义滚动条?

我已经搜索了很多东西来添加这样的滚动条,最后我得到了这个。

谢谢大家。

【问题讨论】:

    标签: css reactjs material-ui


    【解决方案1】:
    import React from "react";
    import { Box} from "@material-ui/core";
    import { makeStyles } from "@material-ui/core/styles";
    
    const useStyles = makeStyles((theme) => ({
      root: {
        "&::-webkit-scrollbar": {
          width: 7,
        },
        "&::-webkit-scrollbar-track": {
          boxShadow: `inset 0 0 6px rgba(0, 0, 0, 0.3)`,
        },
        "&::-webkit-scrollbar-thumb": {
          backgroundColor: "darkgrey",
          outline: `1px solid slategrey`,
        },
      },
    }));
    
    export default const Customscroll= (props) => {
      const classes = useStyles();
    
      return (
        <Box  className={classes.root}>
        </Box>
      );
    

    };

    【讨论】:

      猜你喜欢
      • 2021-10-03
      • 1970-01-01
      • 1970-01-01
      • 2019-05-26
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      相关资源
      最近更新 更多