sidebar-09.json — ui Source File
Architecture documentation for sidebar-09.json, a json file in the ui codebase.
Entity Profile
Source Code
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "sidebar-09",
"type": "registry:block",
"author": "shadcn (https://ui.shadcn.com)",
"description": "Collapsible nested sidebars.",
"registryDependencies": [
"sidebar",
"breadcrumb",
"separator",
"collapsible",
"dropdown-menu",
"avatar",
"switch",
"label"
],
"files": [
{
"path": "blocks/sidebar-09/page.tsx",
"content": "import { AppSidebar } from \"@/registry/default/blocks/sidebar-09/components/app-sidebar\"\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"@/registry/default/ui/breadcrumb\"\nimport { Separator } from \"@/registry/default/ui/separator\"\nimport {\n SidebarInset,\n SidebarProvider,\n SidebarTrigger,\n} from \"@/registry/default/ui/sidebar\"\n\nexport default function Page() {\n return (\n <SidebarProvider\n style={\n {\n \"--sidebar-width\": \"350px\",\n } as React.CSSProperties\n }\n >\n <AppSidebar />\n <SidebarInset>\n <header className=\"sticky top-0 flex shrink-0 items-center gap-2 border-b bg-background p-4\">\n <SidebarTrigger className=\"-ml-1\" />\n <Separator orientation=\"vertical\" className=\"mr-2 h-4\" />\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem className=\"hidden md:block\">\n <BreadcrumbLink href=\"#\">All Inboxes</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbSeparator className=\"hidden md:block\" />\n <BreadcrumbItem>\n <BreadcrumbPage>Inbox</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n </header>\n <div className=\"flex flex-1 flex-col gap-4 p-4\">\n {Array.from({ length: 24 }).map((_, index) => (\n <div\n key={index}\n className=\"aspect-video h-12 w-full rounded-lg bg-muted/50\"\n />\n ))}\n </div>\n </SidebarInset>\n </SidebarProvider>\n )\n}\n",
"type": "registry:page",
"target": "app/dashboard/page.tsx"
},
{
"path": "blocks/sidebar-09/components/app-sidebar.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ArchiveX, Command, File, Inbox, Send, Trash2 } from \"lucide-react\"\n\nimport { NavUser } from \"@/registry/default/blocks/sidebar-09/components/nav-user\"\nimport { Label } from \"@/registry/default/ui/label\"\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupContent,\n SidebarHeader,\n SidebarInput,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"@/registry/default/ui/sidebar\"\nimport { Switch } from \"@/registry/default/ui/switch\"\n\n// This is sample data\nconst data = {\n user: {\n name: \"shadcn\",\n email: \"m@example.com\",\n avatar: \"/avatars/shadcn.jpg\",\n },\n navMain: [\n {\n title: \"Inbox\",\n url: \"#\",\n icon: Inbox,\n isActive: true,\n },\n {\n title: \"Drafts\",\n url: \"#\",\n icon: File,\n isActive: false,\n },\n {\n title: \"Sent\",\n url: \"#\",\n icon: Send,\n isActive: false,\n },\n {\n title: \"Junk\",\n url: \"#\",\n icon: ArchiveX,\n isActive: false,\n },\n {\n title: \"Trash\",\n url: \"#\",\n icon: Trash2,\n isActive: false,\n },\n ],\n mails: [\n {\n name: \"William Smith\",\n email: \"williamsmith@example.com\",\n subject: \"Meeting Tomorrow\",\n date: \"09:34 AM\",\n teaser:\n \"Hi team, just a reminder about our meeting tomorrow at 10 AM.\\nPlease come prepared with your project updates.\",\n },\n {\n name: \"Alice Smith\",\n email: \"alicesmith@example.com\",\n subject: \"Re: Project Update\",\n date: \"Yesterday\",\n teaser:\n \"Thanks for the update. The progress looks great so far.\\nLet's schedule a call to discuss the next steps.\",\n },\n {\n name: \"Bob Johnson\",\n email: \"bobjohnson@example.com\",\n subject: \"Weekend Plans\",\n date: \"2 days ago\",\n teaser:\n \"Hey everyone! I'm thinking of organizing a team outing this weekend.\\nWould you be interested in a hiking trip or a beach day?\",\n },\n {\n name: \"Emily Davis\",\n email: \"emilydavis@example.com\",\n subject: \"Re: Question about Budget\",\n date: \"2 days ago\",\n teaser:\n \"I've reviewed the budget numbers you sent over.\\nCan we set up a quick call to discuss some potential adjustments?\",\n },\n {\n name: \"Michael Wilson\",\n email: \"michaelwilson@example.com\",\n subject: \"Important Announcement\",\n date: \"1 week ago\",\n teaser:\n \"Please join us for an all-hands meeting this Friday at 3 PM.\\nWe have some exciting news to share about the company's future.\",\n },\n {\n name: \"Sarah Brown\",\n email: \"sarahbrown@example.com\",\n subject: \"Re: Feedback on Proposal\",\n date: \"1 week ago\",\n teaser:\n \"Thank you for sending over the proposal. I've reviewed it and have some thoughts.\\nCould we schedule a meeting to discuss my feedback in detail?\",\n },\n {\n name: \"David Lee\",\n email: \"davidlee@example.com\",\n subject: \"New Project Idea\",\n date: \"1 week ago\",\n teaser:\n \"I've been brainstorming and came up with an interesting project concept.\\nDo you have time this week to discuss its potential impact and feasibility?\",\n },\n {\n name: \"Olivia Wilson\",\n email: \"oliviawilson@example.com\",\n subject: \"Vacation Plans\",\n date: \"1 week ago\",\n teaser:\n \"Just a heads up that I'll be taking a two-week vacation next month.\\nI'll make sure all my projects are up to date before I leave.\",\n },\n {\n name: \"James Martin\",\n email: \"jamesmartin@example.com\",\n subject: \"Re: Conference Registration\",\n date: \"1 week ago\",\n teaser:\n \"I've completed the registration for the upcoming tech conference.\\nLet me know if you need any additional information from my end.\",\n },\n {\n name: \"Sophia White\",\n email: \"sophiawhite@example.com\",\n subject: \"Team Dinner\",\n date: \"1 week ago\",\n teaser:\n \"To celebrate our recent project success, I'd like to organize a team dinner.\\nAre you available next Friday evening? Please let me know your preferences.\",\n },\n ],\n}\n\nexport function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {\n // Note: I'm using state to show active item.\n // IRL you should use the url/router.\n const [activeItem, setActiveItem] = React.useState(data.navMain[0])\n const [mails, setMails] = React.useState(data.mails)\n const { setOpen } = useSidebar()\n\n return (\n <Sidebar\n collapsible=\"icon\"\n className=\"overflow-hidden [&>[data-sidebar=sidebar]]:flex-row\"\n {...props}\n >\n {/* This is the first sidebar */}\n {/* We disable collapsible and adjust width to icon. */}\n {/* This will make the sidebar appear as icons. */}\n <Sidebar\n collapsible=\"none\"\n className=\"!w-[calc(var(--sidebar-width-icon)_+_1px)] border-r\"\n >\n <SidebarHeader>\n <SidebarMenu>\n <SidebarMenuItem>\n <SidebarMenuButton size=\"lg\" asChild className=\"md:h-8 md:p-0\">\n <a href=\"#\">\n <div className=\"flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground\">\n <Command className=\"size-4\" />\n </div>\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">Acme Inc</span>\n <span className=\"truncate text-xs\">Enterprise</span>\n </div>\n </a>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n </SidebarHeader>\n <SidebarContent>\n <SidebarGroup>\n <SidebarGroupContent className=\"px-1.5 md:px-0\">\n <SidebarMenu>\n {data.navMain.map((item) => (\n <SidebarMenuItem key={item.title}>\n <SidebarMenuButton\n tooltip={{\n children: item.title,\n hidden: false,\n }}\n onClick={() => {\n setActiveItem(item)\n const mail = data.mails.sort(() => Math.random() - 0.5)\n setMails(\n mail.slice(\n 0,\n Math.max(5, Math.floor(Math.random() * 10) + 1)\n )\n )\n setOpen(true)\n }}\n isActive={activeItem?.title === item.title}\n className=\"px-2.5 md:px-2\"\n >\n <item.icon />\n <span>{item.title}</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n </SidebarContent>\n <SidebarFooter>\n <NavUser user={data.user} />\n </SidebarFooter>\n </Sidebar>\n\n {/* This is the second sidebar */}\n {/* We disable collapsible and let it fill remaining space */}\n <Sidebar collapsible=\"none\" className=\"hidden flex-1 md:flex\">\n <SidebarHeader className=\"gap-3.5 border-b p-4\">\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"text-base font-medium text-foreground\">\n {activeItem?.title}\n </div>\n <Label className=\"flex items-center gap-2 text-sm\">\n <span>Unreads</span>\n <Switch className=\"shadow-none\" />\n </Label>\n </div>\n <SidebarInput placeholder=\"Type to search...\" />\n </SidebarHeader>\n <SidebarContent>\n <SidebarGroup className=\"px-0\">\n <SidebarGroupContent>\n {mails.map((mail) => (\n <a\n href=\"#\"\n key={mail.email}\n className=\"flex flex-col items-start gap-2 whitespace-nowrap border-b p-4 text-sm leading-tight last:border-b-0 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n >\n <div className=\"flex w-full items-center gap-2\">\n <span>{mail.name}</span>{\" \"}\n <span className=\"ml-auto text-xs\">{mail.date}</span>\n </div>\n <span className=\"font-medium\">{mail.subject}</span>\n <span className=\"line-clamp-2 w-[260px] whitespace-break-spaces text-xs\">\n {mail.teaser}\n </span>\n </a>\n ))}\n </SidebarGroupContent>\n </SidebarGroup>\n </SidebarContent>\n </Sidebar>\n </Sidebar>\n )\n}\n",
"type": "registry:component",
"target": ""
},
{
"path": "blocks/sidebar-09/components/nav-user.tsx",
"content": "\"use client\"\n\nimport {\n BadgeCheck,\n Bell,\n ChevronsUpDown,\n CreditCard,\n LogOut,\n Sparkles,\n} from \"lucide-react\"\n\nimport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n} from \"@/registry/default/ui/avatar\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@/registry/default/ui/dropdown-menu\"\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"@/registry/default/ui/sidebar\"\n\nexport function NavUser({\n user,\n}: {\n user: {\n name: string\n email: string\n avatar: string\n }\n}) {\n const { isMobile } = useSidebar()\n\n return (\n <SidebarMenu>\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <SidebarMenuButton\n size=\"lg\"\n className=\"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground md:h-8 md:p-0\"\n >\n <Avatar className=\"h-8 w-8 rounded-lg\">\n <AvatarImage src={user.avatar} alt={user.name} />\n <AvatarFallback className=\"rounded-lg\">CN</AvatarFallback>\n </Avatar>\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user.name}</span>\n <span className=\"truncate text-xs\">{user.email}</span>\n </div>\n <ChevronsUpDown className=\"ml-auto size-4\" />\n </SidebarMenuButton>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n className=\"w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg\"\n side={isMobile ? \"bottom\" : \"right\"}\n align=\"end\"\n sideOffset={4}\n >\n <DropdownMenuLabel className=\"p-0 font-normal\">\n <div className=\"flex items-center gap-2 px-1 py-1.5 text-left text-sm\">\n <Avatar className=\"h-8 w-8 rounded-lg\">\n <AvatarImage src={user.avatar} alt={user.name} />\n <AvatarFallback className=\"rounded-lg\">CN</AvatarFallback>\n </Avatar>\n <div className=\"grid flex-1 text-left text-sm leading-tight\">\n <span className=\"truncate font-semibold\">{user.name}</span>\n <span className=\"truncate text-xs\">{user.email}</span>\n </div>\n </div>\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem>\n <Sparkles />\n Upgrade to Pro\n </DropdownMenuItem>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem>\n <BadgeCheck />\n Account\n </DropdownMenuItem>\n <DropdownMenuItem>\n <CreditCard />\n Billing\n </DropdownMenuItem>\n <DropdownMenuItem>\n <Bell />\n Notifications\n </DropdownMenuItem>\n </DropdownMenuGroup>\n <DropdownMenuSeparator />\n <DropdownMenuItem>\n <LogOut />\n Log out\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n </SidebarMenu>\n )\n}\n",
"type": "registry:component",
"target": ""
}
],
"categories": [
"sidebar",
"dashboard"
]
}
Source
Frequently Asked Questions
What does sidebar-09.json do?
sidebar-09.json is a source file in the ui codebase, written in json.
Where is sidebar-09.json in the architecture?
sidebar-09.json is located at apps/v4/public/r/styles/default/sidebar-09.json (directory: apps/v4/public/r/styles/default).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free