UIPackage
Menu

Framework

Change language

Boilerplate repo

Documentation Sidebar

blocklayout

Docs-style sidebar with a version switcher at the top, a search input below, and collapsible navigation groups. All sample data inlined so consumers edit routes in place.

Also available for Vue ->

Installation

$npx shadcn@latest add https://uipkge.dev/r/react/sidebar-03.json
Named registry:npx shadcn@latest add @uipkge-react/sidebar-03Installs to:components/blocks/sidebar-03/

Variants

Loading interactive previews…

Files installed (4)

  • components/blocks/sidebar-03/Sidebar03.tsx3.8 kB
    'use client'
    
    import { ChevronRight } from 'lucide-react'
    import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
    import {
      Sidebar,
      SidebarContent,
      SidebarGroup,
      SidebarGroupContent,
      SidebarGroupLabel,
      SidebarHeader,
      SidebarMenu,
      SidebarMenuButton,
      SidebarMenuItem,
      SidebarRail,
    } from '@/components/ui/sidebar'
    import { SearchForm } from './SearchForm'
    import { VersionSwitcher } from './VersionSwitcher'
    
    // This is sample data.
    const data = {
      versions: ['1.0.1', '1.1.0-alpha', '2.0.0-beta1'],
      navMain: [
        {
          title: 'Getting Started',
          url: '#',
          items: [
            { title: 'Installation', url: '#' },
            { title: 'Project Structure', url: '#' },
          ],
        },
        {
          title: 'Building Your Application',
          url: '#',
          items: [
            { title: 'Routing', url: '#' },
            { title: 'Data Fetching', url: '#', isActive: true },
            { title: 'Rendering', url: '#' },
            { title: 'Caching', url: '#' },
            { title: 'Styling', url: '#' },
            { title: 'Optimizing', url: '#' },
            { title: 'Configuring', url: '#' },
            { title: 'Testing', url: '#' },
            { title: 'Authentication', url: '#' },
            { title: 'Deploying', url: '#' },
            { title: 'Upgrading', url: '#' },
            { title: 'Examples', url: '#' },
          ],
        },
        {
          title: 'API Reference',
          url: '#',
          items: [
            { title: 'Components', url: '#' },
            { title: 'File Conventions', url: '#' },
            { title: 'Functions', url: '#' },
            { title: 'next.config.js Options', url: '#' },
            { title: 'CLI', url: '#' },
            { title: 'Edge Runtime', url: '#' },
          ],
        },
        {
          title: 'Architecture',
          url: '#',
          items: [
            { title: 'Accessibility', url: '#' },
            { title: 'Fast Refresh', url: '#' },
            { title: 'Next.js Compiler', url: '#' },
            { title: 'Supported Browsers', url: '#' },
            { title: 'Turbopack', url: '#' },
          ],
        },
        {
          title: 'Community',
          url: '#',
          items: [{ title: 'Contribution Guide', url: '#' }],
        },
      ],
    }
    
    type NavItem = (typeof data.navMain)[number]
    type NavChild = NavItem['items'][number] & { isActive?: boolean }
    
    export function Sidebar03() {
      return (
        <Sidebar data-slot="sidebar-03">
          <SidebarHeader>
            <VersionSwitcher versions={data.versions} defaultVersion={data.versions[0]!} />
            <SearchForm />
          </SidebarHeader>
          <SidebarContent className="gap-0">
            {data.navMain.map((item) => (
              <Collapsible key={item.title} title={item.title} defaultOpen className="group/collapsible">
                <SidebarGroup>
                  <SidebarGroupLabel
                    asChild
                    className="group/label text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground text-sm"
                  >
                    <CollapsibleTrigger>
                      {item.title}
                      <ChevronRight className="ml-auto transition-transform group-data-[state=open]/collapsible:rotate-90" />
                    </CollapsibleTrigger>
                  </SidebarGroupLabel>
                  <CollapsibleContent>
                    <SidebarGroupContent>
                      <SidebarMenu>
                        {(item.items as NavChild[]).map((childItem) => (
                          <SidebarMenuItem key={childItem.title}>
                            <SidebarMenuButton asChild isActive={childItem.isActive}>
                              <a href={item.url}>{childItem.title}</a>
                            </SidebarMenuButton>
                          </SidebarMenuItem>
                        ))}
                      </SidebarMenu>
                    </SidebarGroupContent>
                  </CollapsibleContent>
                </SidebarGroup>
              </Collapsible>
            ))}
          </SidebarContent>
          <SidebarRail />
        </Sidebar>
      )
    }
    
  • components/blocks/sidebar-03/SearchForm.tsx0.7 kB
  • components/blocks/sidebar-03/VersionSwitcher.tsx2.3 kB
  • app/sidebar-03-demo/page.tsx1.2 kB

Raw manifest:https://uipkge.dev/r/react/sidebar-03.json