Next.js Discord

Discord Forum

sidebar trigger not working on mobile

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Pressing the toggle button on mobile does not show my sidebar. I am using the shadcn sidebar component.

Why is this happening?


code is:

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <SidebarProvider>
      <AppSidebar />
      <main className="w-full">
        <header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12">
          <div className="w-full flex items-center gap-2 px-4">
            <SidebarTrigger />
            <Separator
              orientation="vertical"
              className="mr-2 data-[orientation=vertical]:h-4"
            />
            <NavBreadcrumb />
          </div>
        </header>
        {children}
      </main>
    </SidebarProvider>
  );
}

1 Reply

American black bearOP
I have to add that this issue does appear only on mobile. Desktop has no issue at using toggle