OfferLifetime Pro for $99

Animated Search Input

The placeholder cycles through examples while the field is empty and idle. It can start as an icon button, opens on click or ⌘K, and closes on Escape when empty. Sent text blurs up and away.

FormsProLifetime access291 lines · one file

The decision inside it

The examples never become the name

The field is always called Search for screen readers; the rotating examples are drawn under it and hidden, so nobody hears a new label every three seconds.

When to use it

Use Animated Search Input for a prominent search on a landing page, docs or an app header, where example searches teach what can be found. For a search inside a form or a filter bar, use the plain Input.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Animated Search Input for this.
Install it: npx shadcn@latest add @layro/animated-search-input
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/animated-search-input.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/doc-search.tsx
import { AnimatedSearchInput } from "@/components/ui/animated-search-input";

export function DocSearch({ search }: { search: (q: string) => void }) {
  return (
    <AnimatedSearchInput
      placeholders={["Search contracts…", "Try “unsigned this week”", "Search by signer"]}
      onSubmit={search}
      shortcut="mod+k"
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
placeholdersstring[]Example searches that take turns as the placeholder.
intervalnumberMilliseconds each example shows. Default 3000.
expandablebooleanStart as an icon button that opens into the field. Default false.
vanishOnSubmitbooleanBlur the sent text up and away, then clear. Default true.
valuestring—
defaultValuestring—
onValueChange(value: string) => void—
onSubmit(value: string) => voidCalled with the trimmed text on Enter or the send button.
shortcutstringA key that focuses it from anywhere, e.g. "mod+k" or "/".
widthnumberWidth when open, in pixels. Default fills its parent.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-theme

States

All of them are drawn by the component. None is left for you to design.

  • Rotating examples
  • Typing
  • Sent
  • Icon
  • Opened by shortcut
  • Reduced motion

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.