LogoMkSaaS Docs

Sidebar Menus

Configuring the navigation menu for dashboard pages

Defines the navigation menu for dashboard/admin pages, each item is NestedMenuItem.

src/config/sidebar-config.tsx
export function getSidebarLinks(): NestedMenuItem[] {
  const t = useTranslations('Dashboard');
  
  return [
    {
      title: t('dashboard.title'),
      icon: <LayoutDashboardIcon className="size-4 shrink-0" />,
      href: Routes.Dashboard,
      external: false,
    },
    {
      title: t('admin.title'),
      icon: <SettingsIcon className="size-4 shrink-0" />,
      authorizeOnly: ['admin'],
      items: [
        {
          title: t('admin.users.title'),
          icon: <UsersRoundIcon className="size-4 shrink-0" />,
          href: Routes.AdminUsers,
          external: false,
        },
        // More admin items...
      ],
    },
    // More sidebar sections...
  ];
}

The sidebar configuration is similar to the navbar but is specifically designed for the dashboard area. It supports:

  • Top-level links with icons
  • Expandable sections with nested items
  • Role-based visibility through the authorizeOnly property

The sidebar is ideal for providing navigation within authenticated sections of your application, with different options based on user roles.

You can delete or add more items to the sidebar as needed.

Next Steps

Now that you understand the sidebar configuration, explore these related topics:

Table of Contents