LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Layout

Sidebar

Also called side navigation, sidenav, or navigation rail

A vertical panel along the side of an app that holds the main navigation, often collapsible to a slim strip of icons.

import { useState, type ReactNode } from 'react';
import { MotionConfig, motion } from 'motion/react';
import { Tooltip } from '@base-ui/react/tooltip';

type NavItem = { href: string; label: string; icon: ReactNode };
type Props = { items: NavItem[]; currentPath: string };

export function Sidebar({ items, currentPath }: Props) {
  const [collapsed, setCollapsed] = useState(
    () => localStorage.getItem('sidebar') === 'collapsed'
  );

  function toggle() {
    setCollapsed(!collapsed);
    localStorage.setItem('sidebar', collapsed ? 'expanded' : 'collapsed');
  }

  // `layout` animates the width change with transforms, so the page
  // isn't laid out again on every frame.
  return (
    <MotionConfig transition={{ duration: 0.25, ease: [0.23, 1, 0.32, 1] }}>
      <motion.nav
        layout
        aria-label='Main'
        className={`flex h-dvh flex-col gap-1 border-r bg-muted p-3 ${collapsed ? 'w-16' : 'w-60'}`}
      >
        <motion.button
          layout='position'
          type='button'
          onClick={toggle}
          aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
          className='mb-2 size-10 self-end rounded-lg text-muted-foreground hover:bg-background'
        >
          {collapsed ? '»' : '«'}
        </motion.button>
        {items.map((item) => (
          <Tooltip.Root key={item.href} disabled={!collapsed}>
            <Tooltip.Trigger
              render={<motion.a layout='position' href={item.href} />}
              aria-current={item.href === currentPath ? 'page' : undefined}
              className='flex h-10 items-center gap-3 rounded-lg px-3 text-sm text-muted-foreground hover:bg-background aria-[current=page]:bg-background aria-[current=page]:font-medium aria-[current=page]:text-foreground'
            >
              <span className='size-4 shrink-0'>{item.icon}</span>
              <span className={collapsed ? 'sr-only' : 'truncate'}>
                {item.label}
              </span>
            </Tooltip.Trigger>
            <Tooltip.Portal>
              <Tooltip.Positioner side='right' sideOffset={12}>
                <Tooltip.Popup className='rounded-md bg-foreground px-2 py-1 text-xs text-background'>
                  {item.label}
                </Tooltip.Popup>
              </Tooltip.Positioner>
            </Tooltip.Portal>
          </Tooltip.Root>
        ))}
      </motion.nav>
    </MotionConfig>
  );
}
Add a collapsible left sidebar: 240px wide with an icon and label for Home, Inbox, Projects, Calendar, and Settings, highlighting the current page. A toggle button at the top collapses it to a 64px icon-only rail with tooltips on hover, animated over 250ms, and the choice is saved to localStorage. Under 768px, hide it and open it as a drawer from a menu button.

Paste into Layerwise or any AI coding tool.

What is Sidebar?

Most dashboards, admin panels, and productivity apps put navigation in a sidebar on the left: a list of sections with an icon and a label each, the current one highlighted, and the account or settings menu at the bottom. A sidebar fits more items than a top bar and shows the structure of the whole app at a glance.

A collapsible sidebar shrinks to an icon-only rail, about 56 to 64px wide, to give the content more room. Show each label as a tooltip while it is collapsed, remember the choice between visits, and keep the toggle button in the same spot in both states so people can find it again.

On phones there is no room for a permanent panel, so the sidebar usually becomes a drawer that opens from a menu button, or a bottom tab bar. Animating the width directly makes the browser recalculate the page layout on every frame; a layout animation such as Motion’s layout prop gets the same effect with transforms.

Often confused with

Drawer
A drawer slides over the page when opened and closes again. A sidebar is a lasting part of the layout that sits beside the content.

Related terms

All terms

Drawer

A panel that slides in from the edge of the screen, usually the bottom on phones or the side on desktop, to show extra content or options.

Layout animation

An animation that smoothly moves and resizes elements when the layout changes, such as list items gliding to new spots after a sort or filter.

Split screen

A layout that divides the screen into two side-by-side panels, each with its own content, sometimes with a divider you drag to resize.

Responsive design

Designing one layout that adapts to any screen width, rearranging columns, sizes, and navigation at set widths called breakpoints.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
app.acme.com
Acme
Home
Inbox
Projects
Calendar
Settings
Projects
Hot air balloons drifting over a rocky valleyLaunch site
Neon signs glowing over a city street at nightMobile app
Bold strokes of red, yellow, pink, and teal paintBrand refresh
Curved blue-and-white towers seen from belowQ3 report
Monstera leaves against a white wallOnboarding
A dense carpet of red, yellow, and white flowersPricing page