diff --git a/src/components/ui/sidebar/nav-main.tsx b/src/components/ui/sidebar/nav-main.tsx index f50590ab35f..f69eed4e175 100644 --- a/src/components/ui/sidebar/nav-main.tsx +++ b/src/components/ui/sidebar/nav-main.tsx @@ -9,6 +9,7 @@ import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, + useSidebar, } from "@/components/ui/sidebar"; export function NavMain({ @@ -20,6 +21,8 @@ export function NavMain({ icon?: string; }[]; }) { + const { isMobile, setOpenMobile } = useSidebar(); + return ( @@ -31,6 +34,11 @@ export function NavMain({ className={ "text-gray-600 transition font-normal hover:bg-gray-200 hover:text-green-700" } + onClick={() => { + if (isMobile) { + setOpenMobile(false); + } + }} >