Vibary.ai
← Vibe Coding

Tree Node Expand

A folder's chevron turns as its children unfold with a small stagger.

navigationminimalcalminteraction · finite · intermediate · ~0.3s
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.

370 lines · react + motion only
import { useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Tree Node Expand
 *
 * A folder tree that unfolds. The chevron turns to say which way the
 * folder is facing, the space for the children opens, and the children

About this pattern

File explorers, nested folders and any hierarchy that opens in place. Three things happen in sequence and each is deliberately small: the chevron turns to say the folder is now facing the other way, the space for the children opens as a short eased height change because the motion genuinely is a size change, and the children arrive a beat apart so depth is read rather than counted. The cascade comes from parent-to-child variants instead of hand-written delays, which is why it keeps working however deep the tree goes — and why closing runs bottom-up, so a folder appears to fold back into its own row.

File explorer sidebarNested folder browserCategory pickerOrg hierarchy

Where it shows up

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

  • Ridgeline
    Changes
    Commits
    Checks
    Files
    Conversation
    ChangesNew
    Brand refresh.figPriya Raman · 2.4 MB
    Q3 planning.pdfMarcus Bell · 840 KB
    Supplier contract.docxDana Whitfield · 96 KB
    Photography brief.mdNils Bergström · 12 KB
    Invoice 4821.pdfBilling · 64 KB
    Code review

    Folders turn their chevron and reveal nested contents in place.

Related patterns