Code And Chill

Scry — Animated Expanding Search Bar

Component

About

Round search icon that flips open into a full search field while the button glides to the corner and becomes the close. Esc clears then closes, accessible, no bounce. Full component: codeandchill.store/components/scry?utm_source=21st

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Scry — Animated Expanding Search Bar to your project and fits it to your theme.

Code

How Scry — Animated Expanding Search Bar is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useEffect, useState } from "react";
import ScrySearch from "@/components/ui/scry-flip-search-bar";

const settings = {
  placeholder: "Search something…",
  size: 72,
  duration: 0.7,
  showFamily: true,
};

export default function Demo(props: Partial<typeof settings> = {}) {
  const s = { ...settings, ...props };
  // Scry is a light component: open light, then follow the page's `dark` class when it changes.
  const [dark, setDark] = useState(false);

  useEffect(() => {
    const html = document.documentElement;
    const mo = new MutationObserver(() => setDark(html.classList.contains("dark")));
    mo.observe(html, { attributes: true, attributeFilter: ["class"] });
    return () => mo.disconnect();
  }, []);

  const backdrop = dark
    ? "radial-gradient(90% 60% at 42% 8%, rgba(58,235,155,.14), transparent 62%), linear-gradient(180deg, #0c2a2a, #06141a)"
    : "radial-gradient(90% 60% at 42% 8%, rgba(255,255,255,.55), transparent 62%), linear-gradient(180deg, #66f1a4, #24e993)";

  return (
    <div
      className="flex min-h-[100dvh] w-full flex-col items-center justify-center gap-10 overflow-x-hidden px-4 py-12"
      style={{ background: backdrop, backgroundColor: dark ? "#06141a" : "#24e993" }}
    >
      <ScrySearch
        size={s.size}
        placeholder={s.placeholder}
        duration={s.duration}
        skin={dark ? "ink" : "paper"}
      />
      {s.showFamily && (
        <div className="flex w-full flex-wrap items-start justify-center gap-6">
          <ScrySearch size={52} placeholder="Search the archive" skin={dark ? "paper" : "ink"} duration={s.duration} showEcho={false} />
          <ScrySearch size={52} placeholder="Find a recipe" skin="coral" duration={s.duration} showEcho={false} />
          <ScrySearch size={52} placeholder="Search docs" skin="slate" duration={s.duration} showEcho={false} />
        </div>
      )}
    </div>
  );
}

Dependencies

More by Code And Chill

View all
  • Fernly Project Dashboard

    Fernly Project Dashboard

    322
  • Glass Smart Home Dashboard

    Glass Smart Home Dashboard

    53
  • Money River

    Money River

    25
  • Tide Download Button

    Tide Download Button

    19
  • Parachute Download Button

    Parachute Download Button

    5
  • Gulp Delete Button

    Gulp Delete Button

    3
  • Corbel Sales Dashboard

    Corbel Sales Dashboard

    3
  • Sigil OTP Field

    Sigil OTP Field

    2