Velora UI

Animated Sidebar

Icon rail that expands on hover or focus and turns into a drawer on narrow screens.

  • 2.9 KB gzipped
  • Zero dependencies
  • Reduced-motion safe
  • Base UI & Radix compatible
Open in v0
Northwind

Dashboard

Hover the rail or Tab into it to expand it. Pin it open with the toggle at the bottom.

Installation

pnpm dlx shadcn@latest add https://velora.colorlib.com/r/animated-sidebar.json

Adds components/velora/animated-sidebar.tsx.

Examples

Dashboard shell

A pinned-capable rail beside a dashboard with stats, a chart and recent orders.

AAcme Store

Overview

Search orders…

Revenue

$48,210

+12.4%

Orders

1,284

+4.1%

Customers

912

+8.9%

Sales, last 12 weeks

Recent orders
OrderCustomerTotalStatus
#3021Lena Park$240.00Paid
#3020Omar Haddad$89.50Pending
#3019Iris Chen$412.10Paid

Narrow container

Below a 42rem container width the rail becomes a top bar with a drawer.

Daybook

Open the menu for the full-height drawer.

9:00Stand-up
11:00Design review
13:00Lunch with Maya
15:00Ship v2.4

Props

Sidebar

PropTypeDefault
pinned

Controlled pinned-open state of the desktop rail

boolean—
defaultPinned

Initial pinned state when uncontrolled

booleanfalse
onPinnedChange

Called when the pin toggle is pressed

(pinned: boolean) => void—

Also accepts every <div> attribute, forwarded to the root element.

SidebarBody

PropTypeDefault
logo

Icon-sized mark, always visible

React.ReactNode—
title

Product name next to the logo; fades in with the labels

React.ReactNode—
footer

Links pinned to the bottom (e.g. settings or the account)

React.ReactNode—
label

Accessible name of the navigation landmark

string"Main"
pinnable

Show the "Keep expanded" toggle at the bottom of the rail

booleantrue
className

Classes for the navigation panel (rail and drawer)

string—
children*

SidebarLink elements

React.ReactNode—

SidebarLink

PropTypeDefault
icon*

Icon shown in both collapsed and expanded states

React.ReactNode—
label*

Link text; stays the accessible name while the rail is collapsed

string—
active

Marks the current page (sets aria-current="page")

booleanfalse

Also accepts every <a> attribute, forwarded to the root element.

Accessibility

Reduced motion
The rail snaps between its collapsed and expanded widths, labels appear without fading and the drawer opens without sliding.
Keyboard
Links are native anchors; tabbing into the rail expands it. In the narrow layout the menu button opens a modal drawer that keeps Tab inside, closes on Escape or a backdrop click, and returns focus to the button.
Screen readers
A nav landmark (label prop) of links with aria-current on the active page; collapsed labels are only faded, so every link keeps its name, and the menu button reports aria-expanded.