Dropdown Menu not working as expected when inside of SidebarContent #8056
Unanswered
javiervargas02
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm working on a dynamic sidebar. When the sidebar is expanded (on non-mobile devices) or on mobile, I want to render a
Collapsible
component, and that part is already working, no changes/help needed there.The issue comes when the sidebar is collapsed on non-mobile devices. In that case, I want to render a
DropdownMenu
.I'm building my sidebar on top of the
sidebar-07
block. For now, I'm reusing the footer shown in that block with some minor tweaks, and it works fine. Ideally, I want the dropdown menus inside theSidebarContent
to look like the dropdown menu in theSidebarFooter
.However, when I render these dropdown menus inside
SidebarContent
, none of the styles are applied to theDropdownMenuContent
or its children.In the code below, I'm using the dropdown menu implementation from
sidebar-06
almost exactly as shown in the shadcn docs. I only changed some variables to display the correct data and updated the trigger to be an icon (since I'm using thecollapsible
prop set toicons
on the mainSidebar
component).As you can see in the screenshot, the
DropdownMenuTrigger
renders as expected, but theDropdownMenuContent
and its items don't have the correct styles:For comparison, here's how the
SidebarFooter > DropdownMenu
looks (and this is the style I want to achieve):Beta Was this translation helpful? Give feedback.
All reactions