Shehryar Ali

Sidebar Nav

AI chats

About

Collapsible app sidebar with workspace menu, primary nav, searchable chat history and gliding hover states. All items through props.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Sidebar Nav to your project and fits it to your theme.

Code

How Sidebar Nav is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import type { ReactNode } from "react";
import SidebarNav, { type SidebarNavItem, type SidebarRecent, type SidebarWorkspaceAction } from "@/components/ui/sidebar-nav";

/* all content lives here; the component only renders what it is given */

function Icon({ children, size = 18 }: { children: ReactNode; size?: number }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
      {children}
    </svg>
  );
}

const NAV: SidebarNavItem[] = [
  { key: "home", label: "Home", icon: <Icon><path d="M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1h-4v-6H9v6H5a1 1 0 0 1-1-1z" /></Icon> },
  { key: "agents", label: "Agents", icon: <Icon><rect x="5" y="8" width="14" height="11" rx="3" /><path d="M12 4v4M9.5 13h.01M14.5 13h.01" /></Icon> },
  { key: "invite", label: "Invite members", count: "3/10", icon: <Icon><circle cx="10" cy="8" r="3.5" /><path d="M3.5 19a6.5 6.5 0 0 1 13 0M19 8v6M16 11h6" /></Icon> },
];

const RECENTS: SidebarRecent[] = [
  { id: "r1", label: "Q3 churn by plan tier" },
  { id: "r2", label: "Incidents from last night" },
  { id: "r3", label: "Draft release notes v2.14" },
  { id: "r4", label: "Onboarding funnel drop-off" },
  { id: "r5", label: "Rotate staging API keys" },
  { id: "r6", label: "Summarize support backlog" },
  { id: "r7", label: "Compare pricing experiments" },
  { id: "r8", label: "Weekly usage digest" },
  { id: "r9", label: "Migrate billing webhooks" },
];

const ACTIONS: SidebarWorkspaceAction[] = [
  { key: "new", label: "New workspace", divider: true, icon: <Icon size={16}><path d="M12 5v14M5 12h14" /></Icon> },
  { key: "settings", label: "Workspace settings", icon: <Icon size={16}><circle cx="12" cy="12" r="3" /><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z" /></Icon> },
  { key: "invite", label: "Invite team members", icon: <Icon size={16}><circle cx="10" cy="8" r="3.5" /><path d="M3.5 19a6.5 6.5 0 0 1 13 0M19 8v6M16 11h6" /></Icon> },
  { key: "signout", label: "Sign out", divider: true, icon: <Icon size={16}><path d="M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3M10 16l-4-4 4-4M6 12h10" /></Icon> },
];

export default function SidebarNavDemo() {
  return (
    <div className="flex min-h-[520px] w-full items-center justify-center bg-background p-8">
      <SidebarNav
        workspace={{
          name: "Northwind",
          monogram: "N",
          logo: <Icon><path d="M12 3 4 7.5v9L12 21l8-4.5v-9z" /><path d="m4 7.5 8 4.5 8-4.5M12 12v9" /></Icon>,
        }}
        workspaceActions={ACTIONS}
        navItems={NAV}
        recents={RECENTS}
        defaultRecent="r2"
        footerLabel="Upgrade to Pro"
        footerIcon={<Icon size={14}><path d="M13 3 5 14h6l-1 7 8-11h-6z" /></Icon>}
        onNavigate={(key) => console.log("navigate:", key)}
        onPick={(recent) => console.log("open chat:", recent.label)}
        onWorkspaceAction={(key) => console.log("workspace:", key)}
      />
    </div>
  );
}

More by Shehryar Ali

View all
  • Loading State

    Loading State

    19
  • Insight Cards

    Insight Cards

    9
  • Streaming Text

    Streaming Text

    9
  • Murmur Ember Silk

    Murmur Ember Silk

    3
  • Murmur Ember Tide

    Murmur Ember Tide

    1
  • Granite Sky Aurora

    Granite Sky Aurora

    1
  • Prompt Bar

    Prompt Bar

    1
  • Records Table

    Records Table

More in AI chats

View all
  • Agent Chat

    Agent Chat

    21
  • AI Actions

    AI Actions

    372
  • AI Suggestions

    AI Suggestions

    27
  • Interactive LLM Token & Context Window Visualizer

    Interactive LLM Token & Context Window Visualizer

    30
  • AI SaaS Workflow Hero

    AI SaaS Workflow Hero

    36
  • Aquarium Prompt

    Aquarium Prompt

    219
  • Message Parts

    Message Parts

    10
  • AI Chat Composer

    AI Chat Composer

    21