Arun
UX Case Studies03 / 05

UX case study · AI design agent

Prompt to Blade UI

Type your prompt → Claude creates a JSON description of a screen → real Blade components rendered on screen. Built solo for Razorpay's Blade Build Challenge in about 1.5 hours, from my phone with Claude Code.

TypeAI design agent
ContextRazorpay AI × Design Challenge
Built inAbout 1.5 hours, solo
Year2026
31,349Impressions
19,749Reached
610Tried it live
Prompt to Blade UI · one sentence in, an on-brand screen out
a payment successful screenBuild it
BLADE COMPONENTS
Payment successful
24 Jun 2026, 7:42 PM
₹1,499.00
Completed
Download receipt
Share receipt
Fig. 01The whole product in one line: a prompt goes in, real Blade components come out
“
Autonomy bounded by the system, not by the prompt.

01The brief

On 24 Jun 2026 Razorpay ran an AI × Design Meetup for product designers at its Bengaluru office, with talks from its design team, including Saurabh Soni (VP Design) on “The Next Design Frontier”. Then came a build challenge on Blade, Razorpay's design system: two briefs, one evening.

Fig. 02The meetup at Razorpay, Bengaluru. Photos: Razorpay Careers on LinkedIn; the last one is my visitor badge, checked in at 3:26 pm
Brief 1Redesign the event's website in Blade

One page, a known layout, a known answer.

one pagestaticreskin
Brief 2Prompt → Razorpay's Blade UI

Any prompt, any screen, and it has to stay on-brand.

any promptany screenmust stay on-brand

Brief 1 was a reskin with a known answer. Brief 2 was open-ended, and it had to stay on-brand no matter what someone typed. That's the product problem I care about, so I took it.

02The problem

By default, an LLM is a free-form text generator. Ask it to "design a payment screen" and it might hand back code with hard-coded colours like #00ff00, random pixel sizes, a layout that ignores your design system, or a component that doesn't exist. Often useful — but unpredictable. You can't guarantee it'll be on-brand.

It's also non-deterministic and stateless: every run starts from zero, with no memory of the one before, so nothing keeps one screen consistent with the next. Just prompt it, and you get a different screen every run.

Same prompt · run 1 of 6
YouDesign a payment success screen using Razorpay Blade
Claude writesraw code
<Card sx={{ borderRadius: 4, boxShadow: 3 }}>  <CardHeader title="Payment successful"    sx={{ bgcolor: "#6200EE" }} />  <Typography fontSize={40}>    ₹2,499.00</Typography>  <Button sx={{ color: "#6200EE" }}>    Download receipt</Button></Card>
<div className="bg-gradient-to-br  from-[#ff6b6b] to-[#ffb86b]  rounded-[28px] p-[30px]">  <h2 className="text-[28px]">    You're all set</h2>  <p className="text-[46px]">₹2,499</p>  <PillButton>View receipt</PillButton></div>
const Card = styled.div`  background: rgba(17,24,39,.92);  border-radius: 24px; padding: 28px;`<Card>  <GlowCard title="Payment confirmed" />  <Amount size={42}>₹ 2,499.00</Amount>  <Button color="#14b8a6">Done</Button></Card>
<div style={{ fontFamily: "Georgia" }}>  <h1 style={{ fontSize: 40 }}>    Transaction complete</h1>  <p style={{ color: "#0057ff",    fontSize: 50 }}>Rs. 2,499</p>  <a style={{ color: "#0057ff" }}>    Back to home</a></div>
<StatusBox style={{  background: "#ffde59",  border: "3px solid #000",  boxShadow: "8px 8px 0 #000" }}>  <h2 style={{ fontFamily: "Impact" }}>    Payment received!!</h2>  <button style={{ letterSpacing: 4 }}>    CONTINUE</button></StatusBox>
<ReceiptPanel className="bg-[#f5f3ff]  rounded-[16px] p-[22px]  font-[Poppins]">  <Row label="Amount" value="₹2,499" />  <Row label="Status" color="#7c3aed" />  <button className="bg-[#7c3aed]">    Get receipt</button></ReceiptPanel>
It rendersoff-system
raw hex, not a Blade tokeninvented componentsmagic numbers
Fig. 03An illustration of the pattern: the same prompt, a different off-system screen every run. Each one looks plausible on its own, which is exactly the problem

To check it wasn't one bad roll, I sent this exact prompt to six Claude models, twice each.

ModelWhat came back
Haiku 4.5Laravel PHP templates: the other Blade
Sonnet 4.628 to 41 invented “Blade” colours
OpusA different layout every run
All 12 runs5 didn't compile
Off-brand, and different every run. You can't ship that.

03The technique

Don't let it write freely — make it fill a form. The Anthropic API has a feature called structured outputs: you hand the model a schema (a rulebook), and the reply is forced to match it. Claude chooses what goes in the blanks, but it can't add a blank that isn't on the form — the API rejects anything off-shape.

UI_SCHEMA is that strict form — the rulebook the reply is forced to match. Everything Claude is allowed to return is defined in it, and anything off-shape is rejected.

UI_SCHEMA · strict · additionalProperties: false
title *Payment successful✓
elements[0].kindbadge✓
colorpositive✓neutralpositivenegativenoticeinformation
background?background: "#00ff00"✕rejected · there's no field for it
amount.value *2499✓
Fig. 04Claude fills the form. The raw colour has nowhere to go: there's no field for it

For designers: it's a component library with “detach instance” switched off.

The constraint, not the prompt, is what keeps the output on-system.

04What's inside UI_SCHEMA

UI_SCHEMA is a component library written as rules — a fixed set of elements, each with a fixed set of props, and additionalProperties: false at every level.

ui-schema.ts37 lines
export const UI_SCHEMA = {
  type: 'object',
  additionalProperties: false,          // anything off-shape is rejected outright
  required: ['title', 'sections'],
  properties: {
    title:    { type: 'string' },
    subtitle: { type: 'string' },
    sections: { type: 'array', items: {
      additionalProperties: false,
      required: ['elements'],
      properties: {
        variant:  { enum: ['card', 'plain'] },
        layout:   { enum: ['stack', 'grid'] },
        heading:  { type: 'string' },
        elements: { type: 'array', items: { anyOf: [

          // every element Claude may place — and nothing else is valid
          { kind: 'heading',   text,  size?  small | medium | large },
          { kind: 'text',      text,  tone?  normal | subtle | muted },
          { kind: 'amount',    value, label?, currency? },
          { kind: 'statTile',  label, value, currency?, delta?, up? },
          { kind: 'badge',     text,  color? positive | negative | notice |
                                        information | neutral | primary },
          { kind: 'button',    text,  variant? primary | secondary | tertiary, icon? },
          { kind: 'input',     label, placeholder?, inputType? text | email | password | textarea },
          { kind: 'switchRow', title, description?, on? },
          { kind: 'person',    name,  subtitle? },
          { kind: 'feature',   text },
          { kind: 'divider' },

        ]}},
      },
    }},
  },
} as const;

// note: even 'color' is a semantic token — positive, notice — never a hex.

05Blade Schema Playground

Explaining a guardrail is weaker than letting someone hit one — so I built a playground. You assemble a screen the way Claude has to, by filling the fixed form; the exact JSON spec builds alongside; then you try to add a raw colour and feel additionalProperties: false push back. Try it right here.

Blade Schema Playground · build a screen the way Claude has toOpen in a tab

Add components, watch the JSON build, then try to sneak in a colour.

Fig. 05The playground, live: fill the builder, then scroll on to the preview, the exact JSON and the guardrail test

06The renderer — Claude's JSON becomes real Blade

Claude's reply goes through three steps before anything reaches the screen.

{
  "title": "Payment successful",
  "elements": [
    { "kind": "badge", "text": "Paid" },
    { "kind": "amount", "value": 2499 },
    { "kind": "button",
      "text": "Download receipt" }
  ]
}

the filled-in form

"badge"→<Badge>
"amount"→<Amount>
"button"→<Button>

each kind becomes a real Blade component, already carrying Razorpay's tokens

Payment successful
Paid
Amount paid
₹2,499.00
Download receipt

Claude picks the parts and the order. Blade owns every colour, size and font.

Fig. 06From JSON to real Blade, one step at a time

The validated spec never touches the DOM directly. A deterministic renderer walks it and swaps each kind for a real @razorpay/blade component — every colour, space and radius resolved through Blade tokens. An unknown kind is skipped, so schema drift can't crash the screen.

SchemaRenderer.tsx14 lines
// a validated UIScreen  →  real @razorpay/blade components
const Element = ({ el }: { el: UIElement }) => {
  switch (el.kind) {
    case 'heading':   return <Heading size={el.size ?? 'small'} color="surface.text.gray.normal">{el.text}</Heading>;
    case 'text':      return <Text color={TEXT_COLOR[el.tone ?? 'subtle']}>{el.text}</Text>;
    case 'amount':    return <Amount value={el.value} currency={el.currency ?? 'INR'} type="heading" size="large" />;
    case 'badge':     return <Badge color={el.color ?? 'neutral'} emphasis="intense">{el.text}</Badge>;
    case 'button':    return <Button variant={el.variant ?? 'primary'} icon={ICONS[el.icon]} isFullWidth>{el.text}</Button>;
    case 'input':     return el.inputType === 'password' ? <PasswordInput label={el.label} /> : <TextInput label={el.label} type={el.inputType} />;
    case 'switchRow': return <Box …><Text weight="semibold">{el.title}</Text><Switch defaultChecked={el.on} /></Box>;
    case 'divider':   return <Divider />;
    default:          return null;   // unknown kind → skipped, the screen never crashes
  }
};
Prompt to Blade UI — a payment successful screen generated by Claude and rendered in Blade
Fig. 07Preview — the screen Claude generated, rendered with real Blade components
The generated screen as Blade JSX
Fig. 08Code — the exact Blade JSX, ready to lift out

If Claude can't be reached, the studio falls back to pre-built Blade recipes matched by keyword, so it degrades instead of breaking.

The design line: the model owns content and arrangement, the design system owns styling — the schema is where that line is drawn.

07Streaming — it worked, it just felt slow

Once it worked, the next problem was perceived speed. Claude takes about five seconds to finish a screen, and the first version showed a spinner for all of it. So I streamed it: the screen paints as the reply lands, instead of waiting for the whole answer.

One clock, two screens · 5.4 s
Before · wait for all of itWaiting…Built
Claude is designing in Blade…
Payment successful
Your payment has gone through. You're all set.
Paid
Amount paid
₹2,499.00
Paid to Lumen Store · 24 Feb, 4:32 PM
Download receipt
5.4 s
After · paint as it landsWaiting…Designing…Built
Claude is designing in Blade…
Payment successful
Your payment has gone through. You're all set.
Paid
Amount paid
₹2,499.00
Paid to Lumen Store · 24 Feb, 4:32 PM
Download receipt
1.9 s5.4 s
Fig. 09The same screen, side by side: the first version waits for the whole answer, the streamed one paints as it lands
5.4 s1.9 sTime to first pixel
2.5 sFirst full section on screen
8–14Repaints per screen

Measured on the live app: 5 runs, median. The total time is the same; the wait isn't.

Recording · razorpay-challenge.vercel.appTry it live
Fig. 10A real streaming build, captured from the live app

08Reach

People didn't just read it, they tried it. One LinkedIn post reached 19,749 members, and 610 people opened the live app. 41 saves is the number I like: people kept it to come back to.

LinkedIn post analytics for the first four days: 30,189 impressions, 19,229 members reached, 94 reactions, 14 comments, 41 saves, 593 link visits, 266 profile viewers
Fig. 11The post's first four days: 94 reactions · 14 comments · 41 saves · 593 link visits · 266 profile views. Totals to date are at the top of the page
“
AI makes the decisions. The design system guarantees the quality.

09What's next

Next case study

04 / 05