Sidebar 04
block sidebarFloating sidebar variant with rounded corners and inset margins. Uses Sidebar variant="floating" and SidebarMenuSub for nested routes. Sample data inlined so consumers edit routes in place.
Also available for Vue ->Installation
$ pnpm dlx shadcn@latest add https://react.uipkge.dev/r/react/sidebar-04.json$ npx shadcn@latest add https://react.uipkge.dev/r/react/sidebar-04.json$ yarn dlx shadcn@latest add https://react.uipkge.dev/r/react/sidebar-04.json$ bunx shadcn@latest add https://react.uipkge.dev/r/react/sidebar-04.json
Or with the named registry:
npx shadcn@latest add @uipkge-react/sidebar-04
Examples
Schema
Type aliases exported from this item's source. Use these to shape the data you pass in.
NavChild type NavChild { title: string; url: string; isActive?: boolean }
type NavItem = { title: string; url: string; isActive?: boolean; items: NavChild[] }
// This is sample data.
const data: { navMain: NavItem[] } = {
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: '#' }],
},
],
} npm dependencies
Includes
Files (1)
-
components/blocks/sidebar-04/Sidebar04.tsx 4.2 kB
'use client' import { Sidebar, SidebarContent, SidebarGroup, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, } from '@/components/ui/sidebar' type NavChild = { title: string; url: string; isActive?: boolean } type NavItem = { title: string; url: string; isActive?: boolean; items: NavChild[] } // This is sample data. const data: { navMain: NavItem[] } = { 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: '#' }], }, ], } export function Sidebar04() { return ( <Sidebar variant="floating"> <SidebarHeader> <SidebarMenu> <SidebarMenuItem> <SidebarMenuButton size="lg" asChild> <a href="#"> <div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"> <svg viewBox="0 0 24 24" className="size-4" fill="currentColor" aria-hidden="true"> <rect x="2" y="2" width="9" height="9" rx="1.5" /> <rect x="13" y="2" width="9" height="9" rx="1.5" opacity="0.55" /> <rect x="2" y="13" width="9" height="9" rx="1.5" opacity="0.55" /> <rect x="13" y="13" width="9" height="9" rx="1.5" /> </svg> </div> <div className="flex flex-col gap-0.5 leading-none"> <span className="font-medium">uipkge</span> <span className="">v1.0.0</span> </div> </a> </SidebarMenuButton> </SidebarMenuItem> </SidebarMenu> </SidebarHeader> <SidebarContent> <SidebarGroup> <SidebarMenu className="gap-2"> {data.navMain.map((item) => ( <SidebarMenuItem key={item.title}> <SidebarMenuButton asChild isActive={item.isActive}> <a href={item.url} className="font-medium"> {item.title} </a> </SidebarMenuButton> {item.items.length ? ( <SidebarMenuSub className="ml-0 border-l-0 px-1.5"> {item.items.map((childItem) => ( <SidebarMenuSubItem key={childItem.title}> <SidebarMenuSubButton asChild isActive={childItem.isActive}> <a href={childItem.url}>{childItem.title}</a> </SidebarMenuSubButton> </SidebarMenuSubItem> ))} </SidebarMenuSub> ) : null} </SidebarMenuItem> ))} </SidebarMenu> </SidebarGroup> </SidebarContent> </Sidebar> ) }
Raw manifest: https://react.uipkge.dev/r/react/sidebar-04.json