AppSidebar() — ui Function Reference
Architecture documentation for the AppSidebar() function in app-sidebar.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD af91c532_37ff_2002_c0a8_5811656fc49c["AppSidebar()"] 85dedbf5_87bf_ed6f_c221_317ecfc7834b["app-sidebar.tsx"] af91c532_37ff_2002_c0a8_5811656fc49c -->|defined in| 85dedbf5_87bf_ed6f_c221_317ecfc7834b style af91c532_37ff_2002_c0a8_5811656fc49c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/bases/base/blocks/sidebar-09/components/app-sidebar.tsx lines 185–309
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
// Note: I'm using state to show active item.
// IRL you should use the url/router.
const [activeItem, setActiveItem] = React.useState(data.navMain[0])
const [mails, setMails] = React.useState(data.mails)
const { setOpen } = useSidebar()
return (
<Sidebar
collapsible="icon"
className="overflow-hidden *:data-[sidebar=sidebar]:flex-row"
{...props}
>
{/* This is the first sidebar */}
{/* We disable collapsible and adjust width to icon. */}
{/* This will make the sidebar appear as icons. */}
<Sidebar
collapsible="none"
className="w-[calc(var(--sidebar-width-icon)+1px)]! border-r"
>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
size="lg"
className="md:h-8 md:p-0"
render={<a href="#" />}
>
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
<IconPlaceholder
lucide="TerminalIcon"
tabler="IconCommand"
hugeicons="CommandIcon"
phosphor="CommandIcon"
remixicon="RiCommandLine"
className="size-4"
/>
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-medium">Acme Inc</span>
<span className="truncate text-xs">Enterprise</span>
</div>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupContent className="px-1.5 md:px-0">
<SidebarMenu>
{data.navMain.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
tooltip={{
children: item.title,
hidden: false,
}}
onClick={() => {
setActiveItem(item)
const mail = data.mails.sort(() => Math.random() - 0.5)
setMails(
mail.slice(
0,
Math.max(5, Math.floor(Math.random() * 10) + 1)
)
)
setOpen(true)
}}
isActive={activeItem?.title === item.title}
className="px-2.5 md:px-2"
>
{item.icon}
<span>{item.title}</span>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<NavUser user={data.user} />
Domain
Subdomains
Source
Frequently Asked Questions
What does AppSidebar() do?
AppSidebar() is a function in the ui codebase, defined in apps/v4/registry/bases/base/blocks/sidebar-09/components/app-sidebar.tsx.
Where is AppSidebar() defined?
AppSidebar() is defined in apps/v4/registry/bases/base/blocks/sidebar-09/components/app-sidebar.tsx at line 185.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free