Passing props to material UI style

后端 未结 7 462
暗喜
暗喜 2020-12-13 08:41

given card code as in here : card

how can I update the card style or any material UI style as from

    const styles = theme => ({
    card: {
           


        
相关标签:
7条回答
  • 2020-12-13 09:17
    import React from "react";
    import { makeStyles } from "@material-ui/styles";
    import Button from "@material-ui/core/Button";
    
    const useStyles = makeStyles({
      root: {
        background: props => props.color,
        "&:hover": {
          background: props => props.hover
        }
      }
    });
    
    export function MyButton(props) {
      const classes = useStyles({color: 'red', hover: 'green'});
      return <Button className={classes.root}>My Button</Button>;
    }
    
    0 讨论(0)
提交回复
热议问题