James McGrath

What If You Could Just Describe a Component?

Published on Nov 21, 2026
Reading time: 3 minutes

Over the Christmas break in 2024 I built a small experiment I called component-preview. The idea was simple: describe a UI component in plain English and watch it get built in front of you.

Why?

At the time I kept thinking about how much back and forth goes into prototyping a component. A designer or someone on the product side has an idea, writes it up or mocks it, hands it to a dev, and waits. Then there's a round of feedback, and another wait. What if the person with the idea could just describe it, see it, and keep tweaking it themselves until it was close? The dev would get something concrete to start from instead of a spec.

That was the whole question. Could a non-developer prototype a component just by talking to an LLM?

What it did

You type something like "a pricing card with three tiers, the middle one highlighted" and Claude returns HTML styled with Tailwind, rendered right next to the prompt.

The part I cared about most was iterating. After the first version, every prompt sends the current component back along with the change you asked for. So instead of starting over you say "make the button bigger" or "move the price above the title" and refine it step by step, the same way you'd give feedback to a person.

On top of that I added:

  • Reference images. Attach a screenshot or sketch and Claude uses it as a visual guide.
  • An asset library. Upload logos or photos, and Claude references them by ID. The server swaps the IDs for the real images before the component is shown.
  • History. Every version is saved with undo and redo, and you can export and import the whole history as JSON.

How it worked

This was the first thing I built that actually used AI inside it, not just to write it.

It's a SvelteKit app with Svelte 5 and Tailwind, and there really are only two moving parts. The page builds the request to Claude. The first prompt uses a "create a component" system prompt, and every prompt after that uses a "modify this HTML" one that carries the current component along with it. A small server route forwards the request to the Anthropic API, pulls the code out of the reply, and fills in the images. History and assets live in the browser's local storage.

The proof of concept came together in a day. I spent the next week adding the asset uploader and starting on Svelte guidelines, so the next version could generate real Svelte components instead of plain HTML. I also tried splitting the one big page into proper components, but never finished that.

Looking back

It never went further than a prototype. I showed it to the product team at work, and they thought it was interesting, but I don't think they really got it. I think they saw it as a dev tool, not something they could use themselves to prototype a component. They were still used to the handoff process I described above. Prototyping something yourself in a few minutes wasn't how they thought about it yet.

Two years on, this kind of thing is everywhere. Anthropic now has Claude Design, where you describe what you want, see it, and refine it in conversation, which is pretty much the loop I was going for. Tools like Lovable and Replit go even further and build a whole project from a prompt. Mine was smaller: describe one component and get something you could actually use. Vercel's v0 was already doing text-to-UI back in 2023, but this was just an idea I had and wanted to try.

If you want to poke around, the code is on GitHub. Just don't deploy it as-is. It was only ever a local prototype, and the server route will happily spend your API credits for anyone who finds it.