Animated Sidebar

An app-shell sidebar in shadcn's shape (provider, header, groups, menus, sub-menus, rail) whose nested menus open with a clip reveal. On desktop it collapses to an icon strip or off-canvas with Ctrl/Cmd+B; under 768px it becomes a sheet that traps and returns focus.

Preview

Animated Sidebar preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/animated-sidebar
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

AnimatedSidebarProvider

open?
boolean
—
defaultOpen?
boolean
true
onOpenChange?
((open: boolean) => void)
—
openMobile?
boolean
—
defaultOpenMobile?
boolean
false
onOpenMobileChange?
((open: boolean) => void)
—
style?
SidebarProviderStyle
—
className?
string
—

AnimatedSidebarMenuSubButton

icon?
ReactNode
—
href?
string
—
isActive?
boolean
false
disabled?
boolean
false
closeOnSelect?
boolean
true
target?
"_self" | "_blank" | "_parent" | "_top"
—
rel?
string
—
onSelect?
(() => void)
—
className?
string
—

AnimatedSidebarMenuButton

icon?
ReactNode
—
badge?
ReactNode
—
href?
string
—
isActive?
boolean
false
ariaExpanded?
boolean
—
disabled?
boolean
false
closeOnSelect?
boolean
—
target?
"_self" | "_blank" | "_parent" | "_top"
—
rel?
string
—
onSelect?
(() => void)
—
className?
string
—

AnimatedSidebar

className?
string
—
variant?
"inset" | "sidebar" | "floating"
sidebar
side?
"left" | "right"
left
collapsible?
"icon" | "none" | "offcanvas"
icon
ariaLabel?
string
Sidebar
panelClassName?
string
—

AnimatedSidebarTrigger

className?
string
—

AnimatedSidebarClose

className?
string
—

AnimatedSidebarRail

className?
string
—

AnimatedSidebarInset

className?
string
—

AnimatedSidebarHeader

className?
string
—

AnimatedSidebarContent

className?
string
—

AnimatedSidebarFooter

className?
string
—

AnimatedSidebarGroup

className?
string
—

AnimatedSidebarGroupLabel

className?
string
—

AnimatedSidebarGroupContent

className?
string
—

AnimatedSidebarMenu

className?
string
—

AnimatedSidebarMenuItem

className?
string
—

AnimatedSidebarMenuSub

className?
string
—
open
boolean
—

AnimatedSidebarMenuSubItem

className?
string
—

Composition

Wrap the layout in the provider. Header, menu groups, footer and an optional rail live in the sidebar; your page goes in the inset next to it.

AnimatedSidebarProvider
├── AnimatedSidebar
│   ├── AnimatedSidebarHeader
│   ├── AnimatedSidebarContent
│   │   └── AnimatedSidebarMenu
│   ├── AnimatedSidebarFooter
│   └── AnimatedSidebarRail
└── AnimatedSidebarInset

Note: AI Sidebar builds a workspace navigator on top of this shell, holding projects, folders, bookmarks and files.

How it works

Reach for this when an app needs a navigation column that works at every screen size. A provider keeps desktop and mobile open state apart, the sidebar picks how it collapses, and the inset beside it holds your page. Menu contents and the active item stay with your app.

Updated