Passing props to material UI style

后端 未结 7 565
暗喜
暗喜 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 08:58

    Solution for how to use both props and theme in material ui :

    const useStyles = props => makeStyles( theme => ({
        div: {
            width: theme.spacing(props.units || 0)  
        }
    }));
    
    export default function ComponentExample({ children, ...props }){
        const { div } = useStyles(props)();
        return (
            
    {children}
    ); }

提交回复
热议问题