I wanted to achieve a similar effect where the text changes color when hovering over the div. After exploring the documentation, I discovered the 'group' feature which proved to be helpful:
https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-parent-state
I experimented with different hover styles such as:
hover:bg-green-600 text-gray-50
hover:[bg-green-600 text-gray-50]
hover:(bg-green-600 | text-gray-50)
You might want to consider wrapping the button in a div and applying the group class.
The code didn't work initially:
<Link to='/home'>
<div className="p-2.5 mt-3 flex items-center rounded-md px-4 duration-300 cursor-pointer hover:(bg-green-600 text-gray-50)">
<span className="text-[15px] ml-4 text-gray-500 font-bold">Home</span>
</div>
</Link>
However, after using the group feature:
<Link to='/home' className='group'>
<div className="p-2.5 mt-3 flex items-center rounded-md px-4 duration-300 cursor-pointer group-hover:bg-green-600" >
<span className="text-[15px] ml-4 text-gray-500 group-hover:text-gray-50 font-bold">Home</span>
</div>
</Link>
Using the group feature allowed the span text color to change along with the div when hovered, making it easier for the cursor to trigger the hover effect.
I do wish there was a way to apply multiple classes on the same hover state, perhaps this can be considered for future updates...
I hope this information proves useful!