Skip to main content

Generative UI

Generative UI enables Nex-T1 to stream rich, interactive UI components alongside text responses. Instead of just returning data, the AI generates complete, ready-to-render React components for charts, tables, wallet views, and transaction interfaces.

What is Generative UI?

Generative UI is a paradigm where AI agents don’t just return text or JSON data—they stream fully-formed UI components directly to your frontend. When a user asks “Show me ETH price charts for the last 30 days,” Nex-T1:
  1. Fetches the data from on-chain sources
  2. Generates a complete chart component with the data
  3. Streams it to your frontend as a UI block
  4. Your app renders it instantly
This creates seamless, natural interactions where the AI understands not just what data to show, but how to visualize it.

Why Generative UI for Web3?

Context-Aware Visualizations

AI chooses the best visualization based on user intent:
  • Price queries → Line charts
  • Portfolio analysis → Holdings tables
  • Token comparisons → Comparison grids
  • Transaction history → Timeline views

Zero Manual Formatting

No need to parse API responses and format data:
  • Components arrive ready-to-render
  • Data is pre-formatted and validated
  • Styling matches component type
  • Responsive by default

Interactive Elements

Generate actionable UI components:
  • Swap forms with pre-filled data
  • Sign request dialogs
  • Transaction status trackers
  • Approval workflows

Streaming Updates

Real-time component delivery:
  • Progressive rendering as data arrives
  • Multiple components per response
  • Mixed text and UI content
  • Event-driven architecture

Architecture

How It Works

Component Generation Process

  1. Intent Recognition: Agent identifies what visualization is needed
  2. Data Fetching: Retrieves data from appropriate sources
  3. Schema Generation: Creates UI block following app/schemas/ui.py
  4. Streaming: Sends UI block as JSON event
  5. Frontend Rendering: Your app maps ui.kind to React component

Stream Event Types

The streaming API returns three types of events:
Regular text tokens for conversational responses.

Available UI Components

Chart Components

Component Type: price_chartProps:
Use Cases:
  • Token price history
  • Multi-timeframe analysis
  • Price comparison overlays
Example:

Table Components

Component Type: asset_tableProps:
Use Cases:
  • Token lists and rankings
  • Market comparisons
  • Watchlist displays
Example:

Wallet & Transaction Components

Component Type: wallet_pnlProps:
Use Cases:
  • Portfolio performance tracking
  • Profit/loss visualization
  • Historical performance analysis
Example:

NFT Components

Component Type: nft_gridProps:
Use Cases:
  • NFT collection displays
  • Gallery views
  • Wallet NFT portfolios
Example:

Implementation Guide

1. Setting Up the Frontend

Install Dependencies:
Create UIBlockRenderer:

2. Streaming UI Updates

Using Fetch API:

3. Rendering Components Dynamically

Complete Chat Component:

4. State Management

Examples

Simple Chart Generation

User Query: “Show me ETH price for the last 7 days” Stream Response:
Rendered Output: A complete line chart showing ETH price trend.

Complex Dashboard

User Query: “Show me a full analysis of my wallet 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb” Stream Response: Multiple UI blocks in sequence:
  1. Wallet Balance Card: Total portfolio value
  2. Holdings Table: Breakdown by asset
  3. PnL Chart: Performance over time
  4. Recent Transactions: Last 10 transactions

Interactive Swap Interface

User Query: “Swap 1 ETH for USDC” Stream Response:
Rendered: Interactive swap form with sign button that connects to user’s wallet.

Real-Time Price Updates

User Query: “Monitor BTC and ETH prices” Implementation with Continuous Streaming:

Best Practices

Performance Optimization

Error Handling

Accessibility

Mobile Responsiveness

Security Considerations

Critical Security Rules for Sign Requests:
  1. Never Auto-Execute: Always require explicit user confirmation
  2. Display Full Details: Show all transaction parameters in plain language
  3. Validate Addresses: Verify address format and checksum
  4. Network Matching: Ensure connected wallet matches requested chain
  5. Throttle Requests: Debounce consecutive sign_request blocks to prevent spam
  6. Warn on High Values: Alert users for transactions above configured thresholds
  7. Audit Logging: Log all signature requests and outcomes
Example Security Implementation:

TypeScript Types

For type safety, generate TypeScript types from the backend schemas:

Next Steps

Integration Guide

Learn how to integrate Generative UI into your application

API Reference

Explore the streaming API endpoints

Examples

See complete working examples

Tools

Discover available data sources for UI generation
Need Help? Join our developer community or check out the example React implementation in examples/frontend/react/ in the Nex-T1 repository.