Vibary.ai
← Vibe Coding

Sidebar Collapse

A navigation rail narrows to icons, with labels leaving before the width closes so text is never squeezed.

navigationminimalpremiuminteraction · finite · intermediate · ~0.4s
Interactive · click to play
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

416 lines · react + motion only
import { useState, type CSSProperties } from "react";
import { motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Sidebar Collapse
 *
 * A navigation rail that narrows to icons and back. The labels fade out
 * *before* the width starts closing, and fade back in only once it has

About this pattern

The rail that gives a workspace back its horizontal space. The mechanism is ordering, not easing: collapsing fades the labels out first and only then closes the width; expanding opens the width first and brings the labels back after. That single delay is the difference between a rail that feels engineered and one where words visibly compress, wrap and clip on the way in. Width is the one property that genuinely has to animate, so it runs as a short eased tween rather than a spring — a spring would overshoot the rail past its own resting size — while the icons hold the same centre line throughout, giving the eye a fixed anchor as everything else moves.

Workspace navigation railDashboard side navigationAdmin console chromeDocument app sidebar

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • Ridgeline
    Issues
    Backlog
    Active
    Cycles
    Views
    IssuesNew
    Colourway picker drops a frameRID-412 · PriyaIn progress
    Receipt totals misalign on narrowRID-408 · MarcusTodo
    Session expires without warningRID-401 · DanaIn review
    Export queue stalls past 500 rowsRID-397 · NilsTodo
    Search ranks archived firstRID-390 · PriyaDone
    Issue tracker

    The left navigation collapses to a narrow icon rail and back.

Related patterns