Prompt to page: an AI hero where the site builds itself

Build a describe-it-and-it-gets-built showcase in React: a prompt types itself while skeleton blocks glide into a wireframe page, then rearrange for the next prompt.

6 min read

The real component. Click the picture to open it live and try it before you read how it was built.

AI products promise that you describe something and it appears. This showcase acts it out: a prompt types itself, and a page assembles beside it.

Same blocks, new layouts

Every layout the canvas can build has the same number of blocks. So when the prompt changes, blocks don't pop in and out: each glides from its place in one layout to its place in the next, grey while the prompt types and filling with colour when it completes.

src/registry/showcase/prompt/wireframes.ts

// The pages the canvas can build. Every layout has the same number of blocks, so the blocks
// glide from one layout to the next instead of popping in and out.
export type BlockTone = "brand" | "ink" | "soft" | "muted";

export interface WireframeBlock {
  // Tailwind classes for the block's place in the 6-column canvas grid.
  span: string;
  height: string;
  tone: BlockTone;
}

export const BLOCK_TONES: Record<BlockTone, string> = {
  brand: "bg-primary",
  ink: "bg-ink",
  soft: "bg-accent",
  muted: "bg-muted",
};

export const WIREFRAMES: WireframeBlock[][] = [
  [
    { span: "col-span-6", height: "h-6", tone: "muted" },
    { span: "col-span-4", height: "h-28", tone: "brand" },
    { span: "col-span-2", height: "h-28", tone: "ink" },
    { span: "col-span-2", height: "h-16", tone: "soft" },
    { span: "col-span-2", height: "h-16", tone: "soft" },
    { span: "col-span-2", height: "h-16", tone: "soft" },
  ],
  [
    { span: "col-span-6", height: "h-6", tone: "muted" },
    { span: "col-span-6", height: "h-24", tone: "ink" },
    { span: "col-span-3", height: "h-16", tone: "brand" },
    { span: "col-span-3", height: "h-16", tone: "soft" },
    { span: "col-span-2", height: "h-8", tone: "soft" },
    { span: "col-span-4", height: "h-8", tone: "muted" },
  ],
  [
    { span: "col-span-6", height: "h-6", tone: "muted" },
    { span: "col-span-6", height: "h-10", tone: "soft" },
    { span: "col-span-2", height: "h-28", tone: "soft" },
    { span: "col-span-2", height: "h-28", tone: "brand" },
    { span: "col-span-2", height: "h-28", tone: "soft" },
    { span: "col-span-6", height: "h-6", tone: "muted" },
  ],
];
The layouts

src/registry/showcase/prompt/wireframe-canvas.tsx

"use client";

import { AnimatePresence, motion } from "motion/react";
import { Check, LoaderCircle } from "lucide-react";
import { BrowserFrame } from "@/components/ui/browser-frame";
import { SPRING_SOFT } from "@/lib/motion";
import { cn } from "@/lib/utils";
import { BLOCK_TONES, WIREFRAMES } from "./wireframes";

const BLOCK_STEP_S = 0.06;

interface WireframeCanvasProps {
  // Which prompt is on screen; it picks the layout.
  index: number;
  // The prompt is fully typed: the blocks take their colours and the status says it's built.
  isReady: boolean;
  className?: string;
}

// A page that builds itself: grey skeleton blocks while the prompt is typed, which glide into place
// and fill with colour once it's complete.
export function WireframeCanvas({ index, isReady, className }: WireframeCanvasProps) {
  const blocks = WIREFRAMES[index % WIREFRAMES.length];
  return (
    <BrowserFrame address="your-next-site.com" className={cn("w-full", className)}>
      <div aria-hidden className="grid grid-cols-6 content-start gap-2 p-4">
        {blocks.map((block, blockIndex) => (
          <motion.div
            key={blockIndex}
            layout
            transition={{ ...SPRING_SOFT, delay: blockIndex * BLOCK_STEP_S }}
            className={cn(
              "rounded-lg transition-colors duration-500",
              block.span,
              block.height,
              isReady ? BLOCK_TONES[block.tone] : "animate-pulse bg-muted motion-reduce:animate-none",
            )}
          />
        ))}
      </div>
      <div className="absolute right-3 bottom-3">
        <AnimatePresence mode="wait" initial={false}>
          <motion.p
            key={isReady ? "ready" : "building"}
            initial={{ opacity: 0, y: 6 }}
            animate={{ opacity: 1, y: 0 }}
            exit={{ opacity: 0, y: -6 }}
            className="inline-flex items-center gap-1.5 rounded-full border bg-background px-2.5 py-1 text-xs font-medium text-muted-foreground shadow-sm"
          >
            {isReady ? (
              <Check className="size-3.5 text-primary" />
            ) : (
              <LoaderCircle className="size-3.5 animate-spin motion-reduce:animate-none" />
            )}
            {isReady ? "Built" : "Building"}
          </motion.p>
        </AnimatePresence>
      </div>
    </BrowserFrame>
  );
}
The canvas that builds itself

The prompt is the call to action

The prompt field's send button is the page's real call to action. With reduced motion, the first prompt and its page sit complete.

More articles