I am designing a sidebar where the active item should have concave curves on the top-right and bottom-right corners. I’m using Tailwind CSS for styling, and I initially tried setting borderTopRightRadius: '0%'
and borderBottomRightRadius: '0%'
, but it results in straight lines, not the concave curves I want. Here’s a sample of what I want to achieve (include image here).
How can I style my sidebar so that when an item is active, the right side has concave curves, both upwards and downwards?
<li
className={`flex rounded-3xl w-[115%] p-2 cursor-pointer text-gray-300 text-sm items-center gap-x-2 ${
location.pathname === menu.path ? 'active-item' : ''
} hover:bg-white hover:text-black transition duration-300`}
>
<Link to={menu.path} className="flex items-center gap-x-4 w-full">
<span className="icon">{menu.icon}</span>
<span className={`${!open && 'hidden'} origin-left duration-200`}>
{menu.title}
</span>
</Link>
</li>
What I Tried:
-
I set
borderTopRightRadius
andborderBottomRightRadius
to0%
, but it results in straight edges. -
I tried different border-radius values, but I can’t get the concave shape I’m looking for.
Desired Design: I want the right side of the active menu item to have a concave curve similar to what you can see in this image (attach your reference image).
Solution Needed: How can I use Tailwind CSS or custom CSS to get concave curves on the top-right and bottom-right corners of the active sidebar item?
[sidebar which i have created.]
2
Answers
This might not be full answer. I am providing this to you this so that you can take from here.
This might be helpful: Codepen Link