google-labs-code/stitch-sdk
Stitch SDK is a TypeScript library by Google Labs that generates fully rendered UI screens from plain-text prompts and returns both the HTML markup and a screenshot programmatically. Developers describe the interface they want in natural language, and Stitch produces production-ready screen designs for mobile, desktop, tablet, or device-agnostic layouts. The SDK exposes core classes — Stitch, Project, Screen, StitchToolClient, and StitchProxy — that cover the full generation lifecycle from prompt to rendered asset. It supports iterative editing, allowing a generated screen to be refined through follow-up prompts, and can produce design variants for A/B testing or exploration. Stitch integrates with the Vercel AI SDK, making it suitable for agent-driven workflows where a model can call Stitch as a tool to produce UI on demand. Installation is a single npm command, and the API is designed to fit into existing TypeScript projects with minimal setup. It is particularly useful for rapid prototyping, design-to-code pipelines, and AI agents that need to autonomously generate user interfaces without a human designer in the loop.
git clone https://github.com/google-labs-code/stitch-sdk.git
Quick Start Example
import { Stitch } from '@google/stitch-sdk';
const stitch = new Stitch();
// Generate a UI screen from a text prompt
const project = await stitch.createProject(
'A dashboard for monitoring server health'
);
const screen = await project.generateScreen({
prompt: 'Show CPU, memory, and disk metrics with charts',
deviceType: 'DESKTOP',
});
console.log(screen.html); // rendered HTML
console.log(screen.screenshot); // base64 screenshot