Skip to content

Navigation menu

Download .md

Products with many pages, such as the Loka Musik admin, group the menu into titled sections and fold related pages under a parent. The menu lives in the sidebar of the Dashboard frame; this page sets how it grows.

  • Add sections once the menu has more than about seven entries. Name each one after the work it holds, such as “Keuangan & Royalti”.
  • Add a parent when three or more pages belong together, such as the reports. Two related pages stay as pages.
  • A product with five to seven pages keeps the plain list of the Dashboard frame.
DoKeep the menu to two levels: a parent and its pages.
Don'tDon't nest a sub menu in a sub menu; turn that level into tabs on the page.
12345
  1. 1Section label
  2. 2Page with a count
  3. 3Parent, open
  4. 4Sub menu with a guide line
  5. 5Current page

The menu sits on the sidebar surface. Section labels use muted-foreground in text-xs. The current page, also inside a sub menu, uses sidebar-accent. A sub menu hangs from its parent on a border guide line.

  • Two levels at most: a parent and its pages. A deeper area becomes tabs inside its page.
  • A parent is not a page. It only opens and closes its sub menu and has no href. When the area needs an overview, make it the first page, such as “Ringkasan”.
  • Open on arrival: a parent opens by itself when one of its pages is the current page, and its title turns semibold.
  • Open more than one: opening a parent doesn’t close the others.
  • Counts: a badge shows how many things wait, such as open tickets. Show it on the page; on a closed parent, show the sum. Leave out zero.
  • Order: sections run from daily work to setup: overview, operations, clients, money, then system. Settings and administration go last.
  • Icons: first-level pages and parents have an icon; sub menu pages don’t.
  • Icons only: when the sidebar collapses to icons, a parent opens its pages in a menu beside the rail.
  • Phones: the whole menu moves into the sheet, with the same sections and sub menus.

The Dashboard block’s nav takes pages, parents and sections:

Entry Shape Use
Page { title, href, icon?, active?, badge? } A page. active marks the current page; badge is a count.
Parent { title, icon?, items, badge? } Opens a sub menu of pages. No href.
Section { label, items } A titled part of the menu, holding pages and parents.

Pass a list of sections, or a list of pages and parents for a menu without titles. Vue uses the same shapes; Flutter builds the menu from widgets.

import {
BuildingIcon,
CoinsIcon,
FileTextIcon,
LayoutDashboardIcon,
LifeBuoyIcon,
MegaphoneIcon,
MusicIcon,
PercentIcon,
SettingsIcon,
ShieldIcon,
TruckIcon,
} from "lucide-react"
import { DashboardShell, type DashboardNavSection } from "@/components/blocks/dashboard-shell"
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
// The Loka Musik admin menu: titled sections, pages, and parents that open a sub menu.
const nav: DashboardNavSection[] = [
{
label: "Overview & Support",
items: [
{ title: "Dasbor", href: "#dasbor", icon: LayoutDashboardIcon },
{ title: "Tiket Support", href: "#tiket", icon: LifeBuoyIcon, badge: 3 },
{ title: "Pengumuman", href: "#pengumuman", icon: MegaphoneIcon },
],
},
{
label: "Katalog & Operasional",
items: [
{ title: "Pengiriman", href: "#pengiriman", icon: TruckIcon, badge: 12 },
{
title: "Laporan",
icon: FileTextIcon,
items: [
{ title: "Rilisan", href: "#laporan-rilisan" },
{ title: "Laporan Pengiriman", href: "#laporan-pengiriman" },
{ title: "Laporan Trek", href: "#laporan-trek" },
],
},
],
},
{
label: "Manajemen Klien & Artis",
items: [
{ title: "Klien", href: "#klien", icon: BuildingIcon },
{
title: "Artis",
icon: MusicIcon,
items: [
{ title: "Artis", href: "#artis" },
{ title: "Klien Artis", href: "#klien-artis" },
{ title: "Kandidat Premium", href: "#kandidat" },
],
},
],
},
{
label: "Keuangan & Royalti",
items: [
{
title: "Royalti",
icon: CoinsIcon,
items: [
{ title: "Ringkasan", href: "#royalti" },
{ title: "Laporan Royalti", href: "#laporan-royalti", active: true },
{ title: "Unggah Laporan", href: "#unggah" },
{ title: "Penarikan", href: "#penarikan", badge: 5 },
],
},
{
title: "Pajak",
icon: PercentIcon,
items: [
{ title: "Klien PPh21", href: "#pph21" },
{ title: "Pengaturan PPh21", href: "#pph21-pengaturan" },
],
},
],
},
{
label: "Sistem & Master Data",
items: [
{
title: "Pengaturan",
icon: SettingsIcon,
items: [
{ title: "Opsi", href: "#opsi" },
{ title: "Template Email", href: "#template-email" },
],
},
{
title: "Administrasi",
icon: ShieldIcon,
items: [
{ title: "Manajemen Staf", href: "#staf" },
{ title: "Log Aktivitas", href: "#log" },
],
},
],
},
]
export default function NavigationMenuDemo() {
return (
<DashboardShell
nav={nav}
labels={{ search: "Cari rilis, artis, atau dokumen", empty: "Tidak ada yang cocok.", account: "Akun {name}", menu: "Buka menu" }}
logo={
<span className="flex items-center gap-2 font-semibold">
<span className="size-7 rounded-md bg-primary" />
Loka Musik Admin
</span>
}
account={{
name: "Raka Pratama",
initials: "RP",
detail: "raka@contoh.id",
menu: [{ label: "Profil" }, { label: "Keluar", destructive: true }],
}}
search={{ groups: [{ heading: "Menu", items: [{ label: "Laporan Royalti" }, { label: "Penarikan" }] }] }}
>
<h1 className="text-2xl font-semibold">Laporan Royalti</h1>
<p className="mt-1 text-sm text-muted-foreground">Laporan dari aggregator yang sudah diunggah.</p>
<div className="mt-6 grid gap-4 md:grid-cols-3">
{[
["Laporan bulan ini", "18"],
["Menunggu diproses", "4"],
["Total pendapatan", "Rp182.430.000,00"],
].map(([label, value]) => (
<Card key={label}>
<CardHeader>
<CardDescription>{label}</CardDescription>
<CardTitle className="text-2xl tabular-nums">{value}</CardTitle>
</CardHeader>
</Card>
))}
</div>
</DashboardShell>
)
}

The menu is part of the Dashboard block; install it from Dashboard.

  • A parent is a button with aria-expanded and aria-controls pointing at its sub menu.
  • The current page has aria-current="page", inside a sub menu too.
  • A section label names its group of links.
  • A count is read with its page, such as “Tiket Support 3”.