-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv0.gist
More file actions
105 lines (78 loc) · 12.7 KB
/
Copy pathv0.gist
File metadata and controls
105 lines (78 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Iterative UI Generation — v0 by Vercel
> An AI-powered UI generation tool that builds, refines, and deploys full React applications through iterative conversation — not one-shot code generation. For frontend developers and designers who want to go from idea to deployed app without manually writing boilerplate.
Generated by gist • March 2026
---
## Product Overview
- What it is: A conversational UI builder that generates full, deployable React applications using shadcn/ui components — through an iterative refinement loop, not single-prompt code dumps
- Who it's for: Frontend developers, designers with some technical literacy, and product teams who want working UI fast — not a copy-paste snippet but a real app they can deploy or export
- AI approach: AI is the product. There is no manual editor with AI bolted on. The entire creation workflow is conversational: describe what you want, see it rendered live, click on elements to refine them, repeat until done, then deploy
---
## Iterative UI Generation
### Intent
- Goal: Take a user from a natural-language description of a UI to a deployed, production-quality React application — through a back-and-forth refinement loop that converges on what the user actually wants, not what the AI guessed on the first try
- User: Frontend developers who know what good UI looks like but want to skip boilerplate. Designers who can describe what they want but don't want to write JSX. Product people who need a working prototype by end of day. All comfortable iterating — none expecting perfection on the first prompt.
- Core anxiety: "Will this generate throwaway demo code, or something I can actually ship?"
- Not trying to: Be a general-purpose coding assistant. v0 generates UI applications, not backend logic, database schemas, or arbitrary Python scripts.
- Not trying to: Replace a developer's judgment. The user drives refinement. The AI proposes, the user selects, edits, and approves.
- Not trying to: Generate arbitrary component libraries. Output is constrained to shadcn/ui and Tailwind CSS — this is a feature, not a limitation.
### Interaction Model
**Primary flow:**
1. User describes what they want in natural language: "Build me a dashboard for tracking sales metrics with a sidebar nav, charts, and a data table." The prompt is freeform — no templates, no forms, no mode selection.
2. v0 generates a complete, rendered UI in the preview panel. The user sees the actual application — not code, not a wireframe, not a mockup. Live, interactive React rendered in an iframe.
3. User reviews the output. If something is wrong (and something is always wrong on the first pass), they have two paths: type a follow-up message describing the change ("Make the sidebar collapsible and add a dark mode toggle"), or click directly on an element in the rendered preview to select it.
4. When the user clicks on an element, a refinement prompt appears scoped to that element. The user can describe changes to just the selected part: "Make this chart a bar chart instead of a line chart" or "Add a dropdown filter above this table." The AI regenerates only the relevant section.
5. The user repeats steps 3-4 as many times as needed. Each iteration builds on the last. The conversation history and the current state of the generated app are both maintained — the AI understands what it already built.
6. When satisfied, the user deploys directly from v0 to Vercel with one click, or exports the code to continue development locally.
**Key interactions:**
- Select-and-edit: User clicks on a rendered UI element to scope their next instruction to just that part — chosen because full-page regeneration is wasteful when the user knows exactly which element needs work. This turns a conversation into a direct manipulation interface.
- Freeform follow-up prompts: No structured forms or dropdown menus for specifying changes — chosen because the space of possible refinements is too large for predefined options. Natural language handles "make this look more like Stripe's dashboard" in a way no dropdown can.
- Live preview: The generated app renders immediately as a live, interactive iframe — chosen over static screenshots or code-only output because users need to see hover states, responsive behavior, and interaction patterns to evaluate the output.
- One-click deploy: Deploy to Vercel directly from the generation interface — chosen because the gap between "this looks right" and "this is live" should be zero steps, not a manual export-build-deploy pipeline.
**When things go wrong:**
- AI generates the wrong layout entirely: User types a new message clarifying intent. The AI treats it as a refinement, not a restart — it keeps what worked and changes what didn't. If the user wants a full restart, they say "Start over" explicitly.
- Selected element doesn't change as expected: The user can undo to the previous version. Every iteration is a snapshot the user can return to. No destructive changes.
- Generated code uses non-shadcn/ui components: This shouldn't happen — the system is constrained to shadcn/ui. If the user requests something outside the component set ("add a 3D globe"), v0 either adapts it to available components or explains the limitation.
- Deploy fails: The user sees an error with a specific reason. Most deploy failures come from environment variables or API keys the generated app references but v0 cannot provide.
### Design Decisions
**Constrained to shadcn/ui and Tailwind CSS**
- Chose: All generated output uses shadcn/ui components styled with Tailwind CSS
- Over: Arbitrary React components, Material UI, Chakra UI, unstyled HTML, or letting the AI pick a component library per project
- Because: Constraints produce consistency. When the AI can use any component from any library, output quality is unpredictable and the user gets vendor lock-in to whatever the AI chose. shadcn/ui components are copy-paste-ownable (no package dependency), well-documented, and visually coherent. The constraint also makes the AI dramatically better — it masters one component system instead of poorly approximating many.
**Iterative refinement over one-shot generation**
- Chose: A multi-turn conversation where each message builds on the current state of the generated app
- Over: Single-prompt generation with a "regenerate" button, template-based generation with parameter filling, manual code editing after initial generation
- Because: No one describes a complete application perfectly in one prompt. The first generation is a starting point, not a final product. Iterative refinement matches how designers actually work — see something, react to it, adjust. One-shot generation puts all the pressure on the prompt; iterative generation puts the pressure on the AI to converge.
**Select-and-edit over describe-and-hope**
- Chose: Let users click directly on rendered UI elements to scope refinement instructions
- Over: Requiring users to describe element locations in text ("the third card in the second row"), providing a component tree for navigation, using line numbers or code references
- Because: Users think visually. When a user sees a button that's the wrong color, pointing at it is faster and more precise than describing it. Select-and-edit reduces ambiguity from every refinement prompt. In testing, scoped edits had 2x higher first-attempt success rates compared to unscoped "change the button color" instructions.
**Deploy-from-tool over export-only**
- Chose: One-click deployment to Vercel directly from the v0 interface
- Over: Export-only (download zip, push to GitHub, deploy manually), export to CodeSandbox or StackBlitz, no deployment capability
- Because: The moment between "this looks right" and "let me figure out how to deploy it" is where motivation dies. One-click deploy captures the user's intent at the peak of their satisfaction. It also closes the feedback loop — users can share a live URL immediately for feedback, which often triggers the next round of refinement.
**Live interactive preview over static render**
- Chose: Generated apps render as fully interactive iframes — buttons click, dropdowns open, responsive layouts resize
- Over: Static screenshots of generated output, code-only view with "run it yourself," split-screen code + static preview
- Because: Static previews hide interaction failures. A dropdown that looks correct in a screenshot might open in the wrong direction or overlap other elements. Users need to interact with the generated UI to evaluate it, not just look at it.
### Patterns Used
- Human-in-the-Loop: Every generation is a proposal that requires user review before it goes anywhere. The user drives refinement through follow-up prompts and select-and-edit. The AI never deploys, publishes, or finalizes without explicit user action. → https://aiuxdesign.guide/patterns/human-in-the-loop
- Progressive Disclosure: First interaction is a blank prompt — just type what you want. Select-and-edit, version history, deploy, and export capabilities reveal themselves as the user engages with generated output. No upfront feature tour. → https://aiuxdesign.guide/patterns/progressive-disclosure
- Inline Editing: Select-and-edit allows the user to click on a specific element in the live preview and issue a scoped refinement instruction, rather than describing the element's location in text. The editing context is embedded in the output, not separated into a different panel. → https://aiuxdesign.guide/patterns/inline-editing
- Error Recovery: Every iteration is a recoverable snapshot. Users can undo any refinement step and branch from any previous state. The worst case for a bad AI generation is one click backward. → https://aiuxdesign.guide/patterns/error-recovery
### Constraints
- Technical: Generated output must be valid, self-contained React that deploys to Vercel's edge infrastructure. This rules out server-side dependencies, database connections, or backend logic that can't be expressed as API routes or serverless functions.
- Component: All UI must use shadcn/ui components. When a user requests something outside the component library (e.g., a calendar heatmap), v0 either composes it from available primitives or explains the gap. It never silently imports arbitrary npm packages.
- Platform: Output targets Next.js on Vercel. Generated apps assume the Next.js App Router, Vercel deployment, and Tailwind CSS. Users who want Vue, Svelte, or plain HTML are out of scope.
- Context window: The iterative refinement loop is bounded by model context. Very long conversations (20+ refinement turns on a complex app) may lose early context. The generated code itself is always the source of truth, not the conversation history.
### Not This
- This is not ChatGPT for code. ChatGPT generates code snippets in a chat window that the user copies and pastes somewhere. v0 generates complete, rendered, deployable applications that the user refines iteratively and deploys in one click. The output is a running app, not a code block in a conversation.
- This is not GitHub Copilot. Copilot works inside your editor, autocompleting code line-by-line as you type. v0 works outside any editor — you describe what you want in natural language and get a complete application. Copilot helps you write code faster. v0 replaces the need to write UI code at all.
- This is not a template marketplace. Users don't browse pre-built templates and customize them. They describe what they want from scratch, and the AI generates it. There is no catalog.
- This is not a design tool like Figma. v0 generates working code, not design files. The output is a deployable React application, not a mockup. There are no layers, no vector tools, no design tokens panel.
- This is not a one-shot code generator. The entire value proposition is the iterative loop. Generate, review, select an element, refine, repeat. Products that generate code from a single prompt and stop are solving a different problem.
- Unlike Bolt or Replit Agent, v0 constrains output to shadcn/ui and Tailwind CSS. This is intentional — constrained output is higher quality and visually consistent. v0 trades flexibility for reliability.
### Open Questions
- How to handle long refinement sessions where the user has made 15+ iterations and the early context is lost. Should v0 periodically summarize the current state back to the user for confirmation?
- Whether to support branching — letting users fork from an earlier iteration to explore a different direction without losing their current version.
- How to handle requests that require real backend logic (authentication, database queries). Currently v0 generates mock data. Should it scaffold API routes with placeholder logic, or keep the boundary firm?
- Whether select-and-edit should support multi-select — clicking on several elements to change them as a group ("make all these cards the same height").