I'm creating a website using react and tailwind CSS, I don't know why hover on button is not working.
I added my custom colors all the props but hoverColor are okay, also I don't know why the react icon doesn't work for me.
import React from "react";
function Button(props) {
return (
<button
className={`px-4 py-2 rounded w-max mx-2 ${props.bgColor} ${props.textColor} hover:${props.hoverColor}`}>
{props.text}
</button>
);
}
export default Button;
import React from 'react';
import { IoPersonOutline } from "react-icons/io5";
import Button from './Button';
function Navbar() {
return (
<nav className="flex items-center justify-between h-16 bg-white px-4 shadow-sm">
<div className="flex items-center my-2">
<Button bgColor="bg-red" text="Post Ad"><span className="flex items-center gap-2"><IoPersonOutline /></span>
</Button>
<Button hoverColor='bg-gray' textColor='text-dark-gray' text='Blue' />
<Button hoverColor='bg-light-gray' textColor='text-dark-gray' text='Blue' />
<Button hoverColor='bg-light-gray' textColor='text-dark-gray' text='Blue' />
</div>
<div className="flex items-center my-2">
<input type="text" placeholder="Searching in all..." className="px-4 py-2 rounded-md bg-light-gray text-current" />
<Button textColor="text-dark-gray" text="Search" />
<Button textColor="text-dark-gray" text="Settings" />
<div className="sm:w-px h-8 mx-5 bg-gray"></div>
<h1 className=" text-xl font-bold mr-2 text-red">Divar</h1>
</div>
</nav>
);
}
export default Navbar;
I've done everything I know, but nothing has changed. Please let me know if you can identify what I'm doing wrong.
As per the documentation:
You could:
hoverColorlikecolorto Tailwind class names:safelistthe classes, if you have a limited number of known colors: