For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Expanding Search

A round search button that stretches into a search field and folds back when you're done. A React component built on View Transitions, installed with the shadcn CLI.

Acme

Installation

$ pnpm dlx shadcn@latest add @transition-kit/expanding-search

Usage

import { ExpandingSearch } from "@/components/transitions/expanding-search";
<ExpandingSearch
  placeholder="Search docs…"
  onSubmit={(query) => router.navigate({ to: "/search", search: { query } })}
/>

The field takes focus when it opens. Escape clears the query, then closes the field; leaving an empty field closes it too.

API Reference

ExpandingSearch

PropTypeDefaultDescription
valuestring-Controlled query.
defaultValuestring""Initial query when uncontrolled.
onValueChange(value: string) => void-Called as the query changes.
openboolean-Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void-Called when the field opens or closes.
onSubmit(value: string) => void-Called when the user presses Enter.
placeholderstring"Search…"Input placeholder.
labelstring"Search"Accessible name of the button and input.

Change the corner radius with :root { --tk-ui-expanding-search-radius: 0.5rem; }.