Skip to content

Render product cards, booking pickers, and status badges inside chat

Go beyond plain text walls by returning structured JSON tool payloads that render interactive product cards, slot pickers, and status trackers.

Copy the prompt and paste it into the AI assistant you already use.

Structured UI component design for conversational AI

  1. 01

    Emit typed component schemas, never raw HTML

    Have tools return validated JSON objects (`type: 'product_carousel'`, max 4 items) rendered by vetted React components to eliminate XSS risks.

  2. 02

    Cap carousels at 3 to 4 curated matches

    Nobody swipes through 18 cards inside a chat bubble—rank the top 3 matches and offer one refinement filter ('Want waterproof options?').

  3. 03

    Disable stale interactive cards on later turns

    Once a time slot is booked or an action card is confirmed, lock that historical card to a read-only receipt state so users can't double-submit.

  4. 04

    Always attach a `fallback_text` string

    Include a clean plain-text representation on every rich message so screen readers, CRM logs, and email transcripts stay complete.

Questions and answers

Why shouldn't we let the LLM output raw HTML or custom CSS inside chat?

Allowing raw LLM HTML invites cross-site scripting (XSS) via indirect prompt injection and breaks responsive styling—always bind strict JSON schemas.

When is plain conversational text better than an interactive UI card?

Use plain text for explanations and troubleshooting, and reserve rich UI components for visual comparisons, date selection, and action confirmations.

How do clicks on interactive chat cards report back to the AI agent?

Dispatch a structured client event (`selected_slot: '2026-11-18T14:00Z'`) into the session so the assistant confirms the action seamlessly.

Learn more

Related guides and background articles for this task