DDBS UI
navigation

App Shell

AppShell: a full-height sidebar, top bar and scrolling content. HeaderNavShell: a sticky pill-nav header over a centred content column. Both compose the navigation items above.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/app-shell.json
Fullscreen

Warehouse operations

Last updated today, 14:32

Trucks inside

12

Unassigned

48

Dispatch ready

4

Today's nursing

Trucks inside

12

Unassigned

48

Dispatch ready

4

Usage

app-shell-example.tsx
"use client";

import { useState } from "react";
import { BarChart3, Bell, Home, LifeBuoy, Truck, Users } from "lucide-react";
import { AppShell, HeaderNavShell } from "@dbs/ui";

const icon = "h-[18px] w-[18px]";

function Cards() {
  return (
    <div className="grid gap-3 sm:grid-cols-3">
      {["Trucks inside", "Unassigned", "Dispatch ready"].map((l, i) => (
        <div key={l} className="rounded-2xl border border-line bg-canvas p-4">
          <p className="text-[13px] text-ink-subtle">{l}</p>
          <p className="mt-2 text-3xl font-semibold tabular-nums">{[12, 48, 4][i]}</p>
        </div>
      ))}
    </div>
  );
}

export default function AppShellExample() {
  const [active, setActive] = useState("dashboard");
  return (
    <div className="flex w-full flex-col gap-8 p-4 sm:p-8">
      <div className="h-[520px] overflow-hidden rounded-2xl border border-line [transform:translateZ(0)]">
        <AppShell
          fill="parent"
          sidebar={{
            brand: <span className="text-lg font-semibold">Fleetwise</span>,
            activeId: active,
            sections: [
              { id: "main", title: "Main menu", items: [
                { id: "dashboard", label: "Dashboard", icon: <Home className={icon} />, onClick: () => setActive("dashboard") },
                { id: "fleet", label: "Fleet", icon: <Truck className={icon} />, onClick: () => setActive("fleet") },
                { id: "reports", label: "Reports", icon: <BarChart3 className={icon} />, onClick: () => setActive("reports") },
              ] },
              { id: "support", title: "Support", items: [
                { id: "team", label: "Team", icon: <Users className={icon} />, onClick: () => setActive("team") },
                { id: "help", label: "Help", icon: <LifeBuoy className={icon} />, onClick: () => setActive("help") },
              ] },
            ],
          }}
          topbar={{ title: "Warehouse operations", subtitle: "Last updated today, 14:32", children: <button type="button" aria-label="Notifications" className="flex size-10 items-center justify-center rounded-full border border-line"><Bell className="size-4" /></button> }}
        >
          <Cards />
        </AppShell>
      </div>

      <div className="max-h-[420px] overflow-y-auto rounded-2xl border border-line [transform:translateZ(0)]">
        <HeaderNavShell
          className="!min-h-0"
          header={{
            logo: <span className="text-lg font-semibold">Careline</span>,
            items: ["Dashboard", "Patients", "Doctors", "Schedules"].map((l) => ({ label: l, href: "#", active: l === "Dashboard" })),
            tabs: "tray",
            sticky: false,
          }}
          intro={<h2 className="mt-6 text-3xl font-semibold tracking-tight">Today&apos;s nursing</h2>}
        >
          <Cards />
        </HeaderNavShell>
      </div>
    </div>
  );
}