saadeghi / daisyui

๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ โ€ƒThe most popular, free and open-source Tailwind CSS component library
https://daisyui.com
MIT License
33.68k stars 1.28k forks source link

React component not working with daisyui #864

Closed alexribeirodesa closed 2 years ago

alexribeirodesa commented 2 years ago

here a very simple react+nextjs component to draw the avatar using the code from sample with no modification:

export function Avatar(props) {

return(
    <div className="avatar">
        <div className="w-10 mask mask-squircle">
            <img src="https://api.lorem.space/image/face?hash=47449" />
        </div>
    </div>
)

}

the result is this: image

I'm doing something wrong?? I miss something??

thx

saadeghi commented 2 years ago

Make sure the path to all your react files is specified in content config in tailwind.config.js

content: [
  './pages/**/*.{html,js,jsx,ts,tsx}',
  './components/**/*.{html,js,jsx,ts,tsx}',
  './anything/**/*.{html,js,jsx,ts,tsx}',
],

If this doesn't fix the issue, please share a small repo so I can reproduce the problem

MehdiHali commented 2 years ago

the solution worked very well for me ! thanks. i hope if you can add that somewhere in the Docs so that others not repeat the same mistake.

saadeghi commented 2 years ago

Well... this is not about daisyUI. It's a necessary Tailwind CSS config and it's already documented on the official Tailwind CSS website.