Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set className prop? #74

Open
vndevil opened this issue Sep 23, 2022 · 1 comment
Open

How to set className prop? #74

vndevil opened this issue Sep 23, 2022 · 1 comment

Comments

@vndevil
Copy link

vndevil commented Sep 23, 2022

Hi DEV,

I want to set className prop, but I don't know how to do it

import Lottie from 'lottie-react';
import { makeStyles } from '@mui/styles';

const useStyles = makeStyles(theme => ({
    icon: {
        width: theme.spacing(3),
        height: theme.spacing(3),
        [theme.breakpoints.down('sm')]: {
            width: theme.spacing(2),
            height: theme.spacing(2),
            '& > div': { fontSize: 16 }
        }
    }
}));

export default function LottieAnimation(props) {
    const classes = useStyles();
    
    return <Lottie {...props} className={classes.icon} />
}
@GhostyJade
Copy link

Simply, the component doesn't accept a className as a prop that isn't string type (makeStyles return a function hook, according to MUI v4 legacy documentation.
In the project I'm developing using this library, I use Tailwind CSS v3. I've never tried MUI v5 but I think that something could be achieved with styled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants