Claude Skill

json-render-ui

Generate guardrailed UI from natural language. Emits constrained JSON that a Preact runtime renders. Use when the request is for a dashboard with metrics, charts, or tables; an admin panel; a data visualization interface; or a form-based application.

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download oaustegard-claude-skills-plugins_data-and-visualization_skills_json-render-ui-e39c726.zip · 11 KB
Part of oaustegard/claude-skills — 39 skills

Install

skills CLI npx skills add https://github.com/oaustegard/claude-skills/tree/main/plugins/data-and-visualization/skills/json-render-ui
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install oaustegard-claude-skills@llmmart
Git git clone https://github.com/oaustegard/claude-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole oaustegard/claude-skills collection as a plugin from our marketplace. Git is the plain clone.

README

json-render-ui

Generate guardrailed UI from natural language. Claude emits constrained JSON, skill runtime renders via Preact. No build step required.

Skill manifest

JSON Render UI

Overview

Transform natural language UI requests into working dashboards and applications. Claude acts as the translation layer (prompt → JSON), the skill provides the rendering runtime (JSON → UI).

Architecture:

User prompt → Claude (constrained by catalog) → UITree JSON → Preact renderer → UI

Output Format

Claude emits a UITree structure:

{
  "root": "main",
  "elements": {
    "main": {
      "key": "main",
      "type": "Grid",
      "props": { "columns": 2, "gap": "md" },
      "children": ["metric1", "metric2"]
    },
    "metric1": {
      "key": "metric1",
      "type": "Metric",
      "props": {
        "label": "Revenue",
        "valuePath": "/revenue",
        "format": "currency"
      }
    },
    "metric2": {
      "key": "metric2",
      "type": "Metric",
      "props": {
        "label": "Growth",
        "valuePath": "/growth",
        "format": "percent"
      }
    }
  },
  "data": {
    "revenue": 125000,
    "growth": 0.15
  }
}

Component Catalog

Claude can ONLY use these components. This is the guardrail.

Layout Components

Component Props Children Description
Card title?, description?, padding?: sm\|md\|lg Yes Container with optional header
Grid columns?: 1-4, gap?: sm\|md\|lg Yes CSS grid layout
Stack direction?: horizontal\|vertical, gap?: sm\|md\|lg, align?: start\|center\|end\|stretch Yes Flexbox stack

Data Display

Component Props Children Description
Metric label, valuePath, format?: number\|currency\|percent, trend?: up\|down\|neutral, trendValue? No Single KPI display
Chart type: bar\|line\|pie\|area, dataPath, title?, height? No Data visualization
Table dataPath, columns: [{key, label, format?: text\|currency\|date\|badge}] No Tabular data
List dataPath, emptyMessage? Yes Rendered list from array

Interactive

Component Props Children Description
Button label, action, variant?: primary\|secondary\|danger\|ghost, size?: sm\|md\|lg, disabled? No Clickable action
Select label?, bindPath, options: [{value, label}], placeholder? No Dropdown select
DatePicker label?, bindPath, placeholder? No Date input

Typography

Component Props Children Description
Heading text, level?: h1\|h2\|h3\|h4 No Section heading
Text content, variant?: body\|caption\|label, color?: default\|muted\|success\|warning\|danger No Text paragraph

Status

Component Props Children Description
Badge text, variant?: default\|success\|warning\|danger\|info No Status indicator
Alert type: info\|success\|warning\|error, title, message?, dismissible? No Notification banner

Special

Component Props Children Description
Divider label? No Visual separator
Empty title, description?, action?, actionLabel? No Empty state

Data Binding

Props ending in Path (e.g., valuePath, dataPath, bindPath) reference the data model using JSON Pointer syntax:

  • /revenue → data.revenue
  • /users/0/name → data.users[0].name
  • /filters/dateRange → data.filters.dateRange

Visibility Conditions

Any element can have a visible property:

{
  "type": "Alert",
  "props": { "type": "error", "title": "Error" },
  "visible": { "path": "/hasError" }
}

Visibility expressions:

  • true / false — Static
  • { "path": "/some/path" } — Truthy check
  • { "and": [...] } — All conditions true
  • { "or": [...] } — Any condition true
  • { "not": {...} } — Negation
  • { "eq": [a, b] } — Equality

Generating Output

Step 1: Emit UITree JSON

Analyze the user's request and emit a UITree structure. Include sample data that matches the schema.

Step 2: Create Artifact

Create an HTML artifact that:

  1. Embeds the UITree JSON
  2. Renders the UI

Start from assets/template.html, which already carries the embedded renderer — there is no separate renderer.js to inline.

Constraints

DO:

  • Use only catalog components
  • Provide realistic sample data
  • Use semantic component choices (Metric for KPIs, Table for tabular data)
  • Keep trees flat (no deep nesting beyond 3 levels)

DO NOT:

  • Invent new component types
  • Use arbitrary HTML/CSS
  • Omit required props
  • Create deeply nested structures

Example

User: "Create a sales dashboard with revenue, orders, and a chart showing monthly trends"

Claude outputs:

{
  "root": "dashboard",
  "elements": {
    "dashboard": {
      "key": "dashboard",
      "type": "Stack",
      "props": { "direction": "vertical", "gap": "lg" },
      "children": ["header", "metrics", "chartCard"]
    },
    "header": {
      "key": "header",
      "type": "Heading",
      "props": { "text": "Sales Dashboard", "level": "h1" }
    },
    "metrics": {
      "key": "metrics",
      "type": "Grid",
      "props": { "columns": 3, "gap": "md" },
      "children": ["revenue", "orders", "avgOrder"]
    },
    "revenue": {
      "key": "revenue",
      "type": "Card",
      "props": { "padding": "md" },
      "children": ["revenueMetric"]
    },
    "revenueMetric": {
      "key": "revenueMetric",
      "type": "Metric",
      "props": {
        "label": "Total Revenue",
        "valuePath": "/revenue",
        "format": "currency",
        "trend": "up",
        "trendValue": "12%"
      }
    },
    "orders": {
      "key": "orders",
      "type": "Card",
      "props": { "padding": "md" },
      "children": ["ordersMetric"]
    },
    "ordersMetric": {
      "key": "ordersMetric",
      "type": "Metric",
      "props": {
        "label": "Orders",
        "valuePath": "/orders",
        "format": "number"
      }
    },
    "avgOrder": {
      "key": "avgOrder",
      "type": "Card",
      "props": { "padding": "md" },
      "children": ["avgMetric"]
    },
    "avgMetric": {
      "key": "avgMetric",
      "type": "Metric",
      "props": {
        "label": "Avg Order Value",
        "valuePath": "/avgOrderValue",
        "format": "currency"
      }
    },
    "chartCard": {
      "key": "chartCard",
      "type": "Card",
      "props": { "title": "Monthly Trends", "padding": "md" },
      "children": ["chart"]
    },
    "chart": {
      "key": "chart",
      "type": "Chart",
      "props": {
        "type": "line",
        "dataPath": "/monthlyData",
        "height": 300
      }
    }
  },
  "data": {
    "revenue": 284500,
    "orders": 1247,
    "avgOrderValue": 228,
    "monthlyData": [
      { "month": "Jan", "value": 18000 },
      { "month": "Feb", "value": 22000 },
      { "month": "Mar", "value": 28000 },
      { "month": "Apr", "value": 24000 },
      { "month": "May", "value": 32000 }
    ]
  }
}

Then wrap in the artifact template from assets/template.html.

Files

  • assets/template.html — Complete artifact template with embedded renderer
  • assets/catalog.json — Machine-readable component schemas
  • references/uitree-format.md — Detailed UITree specification
Files (claude-skills)
  • assets
    • catalog.json 6.6 KB
      {
        "name": "json-render-ui",
        "version": "1.0.0",
        "components": {
          "Card": {
            "description": "Container with optional header",
            "hasChildren": true,
            "props": {
              "title": { "type": "string", "required": false },
              "description": { "type": "string", "required": false },
              "padding": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" }
            }
          },
          "Grid": {
            "description": "CSS grid layout",
            "hasChildren": true,
            "props": {
              "columns": { "type": "number", "min": 1, "max": 4, "default": 2 },
              "gap": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" }
            }
          },
          "Stack": {
            "description": "Flexbox stack for layouts",
            "hasChildren": true,
            "props": {
              "direction": { "type": "enum", "values": ["horizontal", "vertical"], "default": "vertical" },
              "gap": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" },
              "align": { "type": "enum", "values": ["start", "center", "end", "stretch"], "default": "stretch" }
            }
          },
          "Metric": {
            "description": "Single KPI display with optional trend",
            "hasChildren": false,
            "props": {
              "label": { "type": "string", "required": true },
              "valuePath": { "type": "string", "required": true, "description": "JSON Pointer to data value" },
              "format": { "type": "enum", "values": ["number", "currency", "percent"], "default": "number" },
              "trend": { "type": "enum", "values": ["up", "down", "neutral"], "required": false },
              "trendValue": { "type": "string", "required": false }
            }
          },
          "Chart": {
            "description": "Data visualization from array data",
            "hasChildren": false,
            "props": {
              "type": { "type": "enum", "values": ["bar", "line", "pie", "area"], "required": true },
              "dataPath": { "type": "string", "required": true, "description": "JSON Pointer to array of {label, value} or {x, y}" },
              "title": { "type": "string", "required": false },
              "height": { "type": "number", "default": 200 }
            }
          },
          "Table": {
            "description": "Tabular data display",
            "hasChildren": false,
            "props": {
              "dataPath": { "type": "string", "required": true },
              "columns": {
                "type": "array",
                "required": true,
                "items": {
                  "type": "object",
                  "properties": {
                    "key": { "type": "string", "required": true },
                    "label": { "type": "string", "required": true },
                    "format": { "type": "enum", "values": ["text", "currency", "date", "badge"], "default": "text" }
                  }
                }
              }
            }
          },
          "List": {
            "description": "Rendered list from array data",
            "hasChildren": true,
            "props": {
              "dataPath": { "type": "string", "required": true },
              "emptyMessage": { "type": "string", "default": "No items" }
            }
          },
          "Button": {
            "description": "Clickable action button",
            "hasChildren": false,
            "props": {
              "label": { "type": "string", "required": true },
              "action": { "type": "string", "required": true, "description": "Action identifier passed to onAction handler" },
              "variant": { "type": "enum", "values": ["primary", "secondary", "danger", "ghost"], "default": "primary" },
              "size": { "type": "enum", "values": ["sm", "md", "lg"], "default": "md" },
              "disabled": { "type": "boolean", "default": false }
            }
          },
          "Select": {
            "description": "Dropdown select input with two-way binding",
            "hasChildren": false,
            "props": {
              "label": { "type": "string", "required": false },
              "bindPath": { "type": "string", "required": true, "description": "JSON Pointer for two-way data binding" },
              "options": {
                "type": "array",
                "required": true,
                "items": {
                  "type": "object",
                  "properties": {
                    "value": { "type": "string", "required": true },
                    "label": { "type": "string", "required": true }
                  }
                }
              },
              "placeholder": { "type": "string", "required": false }
            }
          },
          "DatePicker": {
            "description": "Date input with two-way binding",
            "hasChildren": false,
            "props": {
              "label": { "type": "string", "required": false },
              "bindPath": { "type": "string", "required": true },
              "placeholder": { "type": "string", "required": false }
            }
          },
          "Heading": {
            "description": "Section heading",
            "hasChildren": false,
            "props": {
              "text": { "type": "string", "required": true },
              "level": { "type": "enum", "values": ["h1", "h2", "h3", "h4"], "default": "h2" }
            }
          },
          "Text": {
            "description": "Text paragraph",
            "hasChildren": false,
            "props": {
              "content": { "type": "string", "required": true },
              "variant": { "type": "enum", "values": ["body", "caption", "label"], "default": "body" },
              "color": { "type": "enum", "values": ["default", "muted", "success", "warning", "danger"], "default": "default" }
            }
          },
          "Badge": {
            "description": "Small status indicator",
            "hasChildren": false,
            "props": {
              "text": { "type": "string", "required": true },
              "variant": { "type": "enum", "values": ["default", "success", "warning", "danger", "info"], "default": "default" }
            }
          },
          "Alert": {
            "description": "Notification banner",
            "hasChildren": false,
            "props": {
              "type": { "type": "enum", "values": ["info", "success", "warning", "error"], "required": true },
              "title": { "type": "string", "required": true },
              "message": { "type": "string", "required": false },
              "dismissible": { "type": "boolean", "default": false }
            }
          },
          "Divider": {
            "description": "Visual separator",
            "hasChildren": false,
            "props": {
              "label": { "type": "string", "required": false }
            }
          },
          "Empty": {
            "description": "Empty state placeholder",
            "hasChildren": false,
            "props": {
              "title": { "type": "string", "required": true },
              "description": { "type": "string", "required": false },
              "action": { "type": "string", "required": false, "description": "Action identifier for CTA button" },
              "actionLabel": { "type": "string", "required": false, "description": "Label for CTA button" }
            }
          }
        },
        "actions": {
          "description": "Actions are string identifiers passed to the onAction handler. Define handlers in your app.",
          "examples": ["export_report", "refresh_data", "view_details", "apply_filter", "delete_item"]
        }
      }
      
    • template.html 21.9 KB · in bundle
  • references
    • uitree-format.md 4.6 KB
      # UITree Format Specification
      
      ## Overview
      
      UITree is a flat JSON structure representing a component hierarchy. It's designed for LLM generation—flat structure avoids deep nesting issues with streaming and parsing.
      
      ## Structure
      
      ```typescript
      interface UITree {
        root: string;                    // Key of root element
        elements: Record<string, UIElement>;  // Flat map of all elements
        data?: Record<string, unknown>;  // Data model for bindings
      }
      
      interface UIElement {
        key: string;                     // Unique identifier
        type: string;                    // Component type from catalog
        props: Record<string, unknown>;  // Component props
        children?: string[];             // Keys of child elements
        visible?: VisibilityCondition;   // Optional visibility rule
      }
      ```
      
      ## Key Generation
      
      Keys must be unique within the tree. Conventions:
      - Use descriptive names: `"revenueMetric"`, `"headerCard"`, `"userTable"`
      - For repeated items, use suffixes: `"metric1"`, `"metric2"`
      - Avoid generic names like `"div1"`, `"component3"`
      
      ## Parent-Child Relationships
      
      Children are referenced by key, not embedded:
      
      ```json
      {
        "root": "container",
        "elements": {
          "container": {
            "key": "container",
            "type": "Card",
            "props": { "title": "My Card" },
            "children": ["child1", "child2"]
          },
          "child1": {
            "key": "child1",
            "type": "Text",
            "props": { "content": "First child" }
          },
          "child2": {
            "key": "child2",
            "type": "Text",
            "props": { "content": "Second child" }
          }
        }
      }
      ```
      
      ## Data Binding
      
      ### Value Paths
      
      Props ending in `Path` reference the data model using JSON Pointer syntax:
      
      | Path | Resolves to |
      |------|-------------|
      | `/revenue` | `data.revenue` |
      | `/users/0/name` | `data.users[0].name` |
      | `/settings/theme` | `data.settings.theme` |
      
      ### Read-Only Binding (valuePath, dataPath)
      
      Used for display components. Data flows one way (data → UI):
      
      ```json
      {
        "type": "Metric",
        "props": {
          "label": "Revenue",
          "valuePath": "/revenue"
        }
      }
      ```
      
      ### Two-Way Binding (bindPath)
      
      Used for input components. Data flows both ways:
      
      ```json
      {
        "type": "Select",
        "props": {
          "label": "Status",
          "bindPath": "/filters/status",
          "options": [
            { "value": "active", "label": "Active" },
            { "value": "inactive", "label": "Inactive" }
          ]
        }
      }
      ```
      
      ## Visibility Conditions
      
      Control when elements render:
      
      ### Static
      
      ```json
      { "visible": true }   // Always visible (default)
      { "visible": false }  // Never visible
      ```
      
      ### Path-Based (Truthy Check)
      
      ```json
      { "visible": { "path": "/hasError" } }
      ```
      
      ### Boolean Logic
      
      ```json
      // AND - all must be true
      { "visible": { "and": [{ "path": "/isAdmin" }, { "path": "/hasAccess" }] } }
      
      // OR - any must be true
      { "visible": { "or": [{ "path": "/isOwner" }, { "path": "/isAdmin" }] } }
      
      // NOT - negation
      { "visible": { "not": { "path": "/isHidden" } } }
      ```
      
      ### Comparisons
      
      ```json
      // Equality
      { "visible": { "eq": [{ "path": "/status" }, "active"] } }
      
      // Not equal
      { "visible": { "neq": [{ "path": "/count" }, 0] } }
      
      // Numeric comparisons
      { "visible": { "gt": [{ "path": "/items" }, 5] } }
      { "visible": { "gte": [{ "path": "/items" }, 5] } }
      { "visible": { "lt": [{ "path": "/items" }, 10] } }
      { "visible": { "lte": [{ "path": "/items" }, 10] } }
      ```
      
      ### Complex Example
      
      ```json
      {
        "visible": {
          "and": [
            { "path": "/user/isLoggedIn" },
            { "or": [
              { "eq": [{ "path": "/user/role" }, "admin"] },
              { "gt": [{ "path": "/user/level" }, 5] }
            ]}
          ]
        }
      }
      ```
      
      ## Data Model
      
      The `data` property provides values for bindings:
      
      ```json
      {
        "root": "dashboard",
        "elements": { ... },
        "data": {
          "revenue": 125000,
          "growth": 0.15,
          "users": [
            { "name": "Alice", "status": "active" },
            { "name": "Bob", "status": "pending" }
          ],
          "filters": {
            "status": "all",
            "dateRange": "30d"
          }
        }
      }
      ```
      
      ## Best Practices
      
      ### Keep Trees Flat
      
      Avoid deep nesting. Prefer:
      ```
      Grid → [Card, Card, Card]  (depth 2)
      ```
      
      Over:
      ```
      Grid → Card → Stack → Card → Text  (depth 5)
      ```
      
      ### Use Semantic Components
      
      - **Metrics** for KPIs, not Text with styled numbers
      - **Table** for tabular data, not nested Stacks
      - **Chart** for visualizations, not custom SVG
      
      ### Provide Realistic Data
      
      Always include sample data that matches the expected schema:
      
      ```json
      {
        "type": "Chart",
        "props": {
          "type": "line",
          "dataPath": "/monthlyData"
        }
      }
      // data should include:
      {
        "monthlyData": [
          { "month": "Jan", "value": 1000 },
          { "month": "Feb", "value": 1200 }
        ]
      }
      ```
      
      ### Validate Keys
      
      - Every `children` entry must exist in `elements`
      - `root` must exist in `elements`
      - No circular references
      
  • README.md 154 B
    # json-render-ui
    
    Generate guardrailed UI from natural language. Claude emits constrained JSON, skill runtime renders via Preact. No build step required.
    
  • SKILL.md 7.7 KB
    ---
    name: json-render-ui
    description: "Generate guardrailed UI from natural language. Emits constrained JSON that a Preact runtime renders. Use when the request is for a dashboard with metrics, charts, or tables; an admin panel; a data visualization interface; or a form-based application."
    metadata:
      version: 0.0.2
    ---
    
    # JSON Render UI
    
    ## Overview
    
    Transform natural language UI requests into working dashboards and applications. Claude acts as the translation layer (prompt → JSON), the skill provides the rendering runtime (JSON → UI).
    
    **Architecture:**
    ```
    User prompt → Claude (constrained by catalog) → UITree JSON → Preact renderer → UI
    ```
    
    ## Output Format
    
    Claude emits a **UITree** structure:
    
    ```json
    {
      "root": "main",
      "elements": {
        "main": {
          "key": "main",
          "type": "Grid",
          "props": { "columns": 2, "gap": "md" },
          "children": ["metric1", "metric2"]
        },
        "metric1": {
          "key": "metric1",
          "type": "Metric",
          "props": {
            "label": "Revenue",
            "valuePath": "/revenue",
            "format": "currency"
          }
        },
        "metric2": {
          "key": "metric2",
          "type": "Metric",
          "props": {
            "label": "Growth",
            "valuePath": "/growth",
            "format": "percent"
          }
        }
      },
      "data": {
        "revenue": 125000,
        "growth": 0.15
      }
    }
    ```
    
    ## Component Catalog
    
    Claude can ONLY use these components. This is the guardrail.
    
    ### Layout Components
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Card` | `title?`, `description?`, `padding?: sm\|md\|lg` | Yes | Container with optional header |
    | `Grid` | `columns?: 1-4`, `gap?: sm\|md\|lg` | Yes | CSS grid layout |
    | `Stack` | `direction?: horizontal\|vertical`, `gap?: sm\|md\|lg`, `align?: start\|center\|end\|stretch` | Yes | Flexbox stack |
    
    ### Data Display
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Metric` | `label`, `valuePath`, `format?: number\|currency\|percent`, `trend?: up\|down\|neutral`, `trendValue?` | No | Single KPI display |
    | `Chart` | `type: bar\|line\|pie\|area`, `dataPath`, `title?`, `height?` | No | Data visualization |
    | `Table` | `dataPath`, `columns: [{key, label, format?: text\|currency\|date\|badge}]` | No | Tabular data |
    | `List` | `dataPath`, `emptyMessage?` | Yes | Rendered list from array |
    
    ### Interactive
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Button` | `label`, `action`, `variant?: primary\|secondary\|danger\|ghost`, `size?: sm\|md\|lg`, `disabled?` | No | Clickable action |
    | `Select` | `label?`, `bindPath`, `options: [{value, label}]`, `placeholder?` | No | Dropdown select |
    | `DatePicker` | `label?`, `bindPath`, `placeholder?` | No | Date input |
    
    ### Typography
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Heading` | `text`, `level?: h1\|h2\|h3\|h4` | No | Section heading |
    | `Text` | `content`, `variant?: body\|caption\|label`, `color?: default\|muted\|success\|warning\|danger` | No | Text paragraph |
    
    ### Status
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Badge` | `text`, `variant?: default\|success\|warning\|danger\|info` | No | Status indicator |
    | `Alert` | `type: info\|success\|warning\|error`, `title`, `message?`, `dismissible?` | No | Notification banner |
    
    ### Special
    
    | Component | Props | Children | Description |
    |-----------|-------|----------|-------------|
    | `Divider` | `label?` | No | Visual separator |
    | `Empty` | `title`, `description?`, `action?`, `actionLabel?` | No | Empty state |
    
    ## Data Binding
    
    Props ending in `Path` (e.g., `valuePath`, `dataPath`, `bindPath`) reference the data model using JSON Pointer syntax:
    
    - `/revenue` → `data.revenue`
    - `/users/0/name` → `data.users[0].name`
    - `/filters/dateRange` → `data.filters.dateRange`
    
    ## Visibility Conditions
    
    Any element can have a `visible` property:
    
    ```json
    {
      "type": "Alert",
      "props": { "type": "error", "title": "Error" },
      "visible": { "path": "/hasError" }
    }
    ```
    
    Visibility expressions:
    - `true` / `false` — Static
    - `{ "path": "/some/path" }` — Truthy check
    - `{ "and": [...] }` — All conditions true
    - `{ "or": [...] }` — Any condition true
    - `{ "not": {...} }` — Negation
    - `{ "eq": [a, b] }` — Equality
    
    ## Generating Output
    
    ### Step 1: Emit UITree JSON
    
    Analyze the user's request and emit a UITree structure. Include sample data that matches the schema.
    
    ### Step 2: Create Artifact
    
    Create an HTML artifact that:
    1. Embeds the UITree JSON
    2. Renders the UI
    
    Start from `assets/template.html`, which already carries the embedded renderer —
    there is no separate `renderer.js` to inline.
    
    ## Constraints
    
    **DO:**
    - Use only catalog components
    - Provide realistic sample data
    - Use semantic component choices (Metric for KPIs, Table for tabular data)
    - Keep trees flat (no deep nesting beyond 3 levels)
    
    **DO NOT:**
    - Invent new component types
    - Use arbitrary HTML/CSS
    - Omit required props
    - Create deeply nested structures
    
    ## Example
    
    **User:** "Create a sales dashboard with revenue, orders, and a chart showing monthly trends"
    
    **Claude outputs:**
    
    ```json
    {
      "root": "dashboard",
      "elements": {
        "dashboard": {
          "key": "dashboard",
          "type": "Stack",
          "props": { "direction": "vertical", "gap": "lg" },
          "children": ["header", "metrics", "chartCard"]
        },
        "header": {
          "key": "header",
          "type": "Heading",
          "props": { "text": "Sales Dashboard", "level": "h1" }
        },
        "metrics": {
          "key": "metrics",
          "type": "Grid",
          "props": { "columns": 3, "gap": "md" },
          "children": ["revenue", "orders", "avgOrder"]
        },
        "revenue": {
          "key": "revenue",
          "type": "Card",
          "props": { "padding": "md" },
          "children": ["revenueMetric"]
        },
        "revenueMetric": {
          "key": "revenueMetric",
          "type": "Metric",
          "props": {
            "label": "Total Revenue",
            "valuePath": "/revenue",
            "format": "currency",
            "trend": "up",
            "trendValue": "12%"
          }
        },
        "orders": {
          "key": "orders",
          "type": "Card",
          "props": { "padding": "md" },
          "children": ["ordersMetric"]
        },
        "ordersMetric": {
          "key": "ordersMetric",
          "type": "Metric",
          "props": {
            "label": "Orders",
            "valuePath": "/orders",
            "format": "number"
          }
        },
        "avgOrder": {
          "key": "avgOrder",
          "type": "Card",
          "props": { "padding": "md" },
          "children": ["avgMetric"]
        },
        "avgMetric": {
          "key": "avgMetric",
          "type": "Metric",
          "props": {
            "label": "Avg Order Value",
            "valuePath": "/avgOrderValue",
            "format": "currency"
          }
        },
        "chartCard": {
          "key": "chartCard",
          "type": "Card",
          "props": { "title": "Monthly Trends", "padding": "md" },
          "children": ["chart"]
        },
        "chart": {
          "key": "chart",
          "type": "Chart",
          "props": {
            "type": "line",
            "dataPath": "/monthlyData",
            "height": 300
          }
        }
      },
      "data": {
        "revenue": 284500,
        "orders": 1247,
        "avgOrderValue": 228,
        "monthlyData": [
          { "month": "Jan", "value": 18000 },
          { "month": "Feb", "value": 22000 },
          { "month": "Mar", "value": 28000 },
          { "month": "Apr", "value": 24000 },
          { "month": "May", "value": 32000 }
        ]
      }
    }
    ```
    
    Then wrap in the artifact template from `assets/template.html`.
    
    ## Files
    
    - `assets/template.html` — Complete artifact template with embedded renderer
    - `assets/catalog.json` — Machine-readable component schemas
    - `references/uitree-format.md` — Detailed UITree specification
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related