Vibary.ai
← Vibe Coding

Search Input Expand

A search icon opens into a full field while the controls beside it give up the space.

formsminimalelegantinteraction · 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.

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

/**
 * Vibary · Search Input Expand
 *
 * A search icon in a toolbar opens into a full field. The field takes the
 * width it needs and the controls beside it give way — fading and sliding

About this pattern

Toolbars run out of room long before the features do, so search hides behind its icon until it is wanted. Clicking the icon widens the shell to a typing field on a short eased curve — width is one of the few properties worth animating outright, and a spring here would let the box overshoot the toolbar edge. The neighbouring buttons clear out faster than the field grows, which is what makes the exchange read as one control taking the room rather than two things fighting over it. The caret follows the opening, Escape closes the field, and focus lands back on the icon it came from.

App toolbar searchData grid headerSite header searchInbox filter bar

Where it shows up

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

  • Ridgeline
    Search
    Inbox
    Docs
    Files
    Issues
    SearchNew
    Contract renewalInbox · matched “renewal terms”
    Supplier contract.docxFiles · matched “renewal”
    Q3 planning notesDocs · matched “renewal window”
    RID-412 renewal bannerIssues · matched “renewal”
    Search results

    A toolbar field that stays an icon until it is needed, then claims the row.

Related patterns