Material UI 自定义滚动条

4
如何在Material UI中添加自定义滚动条?
我搜索了很多东西才找到如何添加此类滚动条。
感谢大家。
1个回答

7
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>
  );

};


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接