How do I get a bottom border on the selected NavigationMenuItem
?
#2883
-
I am trying to get a bottom border on the selected I thought that the <NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>...</NavigationMenuItem>
<NavigationMenuItem>...</NavigationMenuItem>
<NavigationMenuItem>...</NavigationMenuItem>
<NavigationMenuIndicator />
</NavigationMenuList>
</NavigationMenu> What is the purpose of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @shadcn, can you please help me understand what is |
Beta Was this translation helpful? Give feedback.
-
I got the bottom border to work by adding the border to the NavigationMenuTriggers and hiding/showing their color depending on whether the NavigationMenuItem is open or not. <NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger
className="border-b-2 border-b-transparent rounded-b-none data-[state='open']:border-black"
>
First
</NavigationMenuTrigger>
<NavigationMenuContent>
<div className="w-96 h-32 bg-white">
Content First
</div>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger
className="border-b-2 border-b-transparent rounded-b-none data-[state='open']:border-black"
>
Second
</NavigationMenuTrigger>
<NavigationMenuContent>
<div className="w-96 h-32 bg-white">
Content Second
</div>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuTrigger
className="border-b-2 border-b-transparent rounded-b-none data-[state='open']:border-black"
>
Third
</NavigationMenuTrigger>
<NavigationMenuContent >
<div className="w-96 h-32 bg-white">
Content Third
</div>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuIndicator />
</NavigationMenuList>
</NavigationMenu> |
Beta Was this translation helpful? Give feedback.
I got the bottom border to work by adding the border to the NavigationMenuTriggers and hiding/showing their color depending on whether the NavigationMenuItem is open or not.
Here's the code, let me know if it works for you!