Skip to content

The Open Standard for Generative UI

Add React-Email + OpenUI Renderer chat (#371)

subham999d3a7b0079
diff --git a/.github/workflows/publish-npm-package.yml b/.github/workflows/publish-npm-package.yml
index c5d557c22..75576c4b6 100644
--- a/.github/workflows/publish-npm-package.yml
+++ b/.github/workflows/publish-npm-package.yml
@@ -8,13 +8,14 @@ on:
workflow_dispatch:
inputs:
package:
- description: "Package to publish (react-ui, react-headless, openui-cli or react-lang)"
+ description: "Package to publish (react-ui, react-headless, react-lang, react-email or openui-cli)"
required: true
type: choice
options:
- react-ui
- react-headless
- react-lang
+ - react-email
- openui-cli
jobs:
diff --git a/docs/content/docs/openui-lang/examples/react-email.mdx b/docs/content/docs/openui-lang/examples/react-email.mdx
new file mode 100644
index 000000000..5b8307c47
--- /dev/null
+++ b/docs/content/docs/openui-lang/examples/react-email.mdx
@@ -0,0 +1,121 @@
+---
+title: React Email
+description: An AI-powered email generator that uses OpenUI Lang to render 44 React Email components from natural language descriptions.
+---
+
+OpenUI Lang isn't limited to chat interfaces — it can power any domain-specific UI generator. This example uses [React Email](https://react.email) components as the rendering target, letting users describe emails in plain English and see them rendered live. The `@openuidev/react-email` package ships 44 email components built with `defineComponent`, a ready-to-use `emailLibrary`, and a system prompt with examples and design rules — so the LLM generates well-structured, email-client-compatible HTML out of the box.
+
+[View source on GitHub →](https://github.com/thesysdev/openui/tree/main/examples/react-email)
+
+<div className="bg-[rgba(0,0,0,0.05)] dark:bg-gray-900 rounded-2xl h-[500px] flex p-2">
+ <video
+ src="/videos/react-email.mp4"
+ noControls
+ playsInline
+ muted
+ preload="metadata"
+ className="w-full rounded-lg m-auto"
+ autoPlay
+ loop
+ />
+</div>
+
+## Building an email library with OpenUI Lang
+
+Each email component wraps a React Email primitive with inline styles (required by email clients that strip `<style>` tags). Here's a simplified example:
+
+```tsx
+const EmailButton = defineComponent({
+ name: "EmailButton",
+ props: z.object({
+ label: z.string(),
+ href: z.string(),
+ backgroundColor: z.string().optional(),
+ }),
+ description: "Email call-to-action button with link.",
+ component: ({ props }) => (
+ <Button
+ href={props.href as string}
+ style={{
+ backgroundColor: (props.backgroundColor as string) ?? "#5F51E8",
+ color: "#ffffff",
+ borderRadius: "6px",
+ padding: "12px 24px",
+ }}
+ >
+ {props.label as string}
+ </Button>
+ ),
+});
+```
+
+All 44 components are assembled into `emailLibrary` via `createLibrary`. Consumers import the library and prompt options — individual components are internal:
+
+```tsx
+import { emailLibrary, emailPromptOptions } from "@openuidev/react-email";
+
+// Generate the system prompt (includes examples + design rules)
+const systemPrompt = emailLibrary.prompt(emailPromptOptions);
+
+// Render streamed OpenUI Lang into email components
+<Renderer response={openuiCode} library={emailLibrary} isStreaming={isStreaming} />;
+```
+
+Once streaming completes, the `useEmailRendering` hook calls `render()` from `@react-email/render` with `{ pretty: true }` client-side to produce formatted HTML for the "Copy HTML" button.
+
+See [Defining Components](/docs/openui-lang/defining-components) for the full `defineComponent` API.
+
+## Architecture
+
+```
+Browser (email editor) -- POST /api/chat --> Next.js route --> OpenAI
+ <-- SSE stream -- (OpenUI Lang)
+```
+
+The client sends a conversation to `/api/chat`. The API route loads a pre-generated `system-prompt.txt` (built from `emailLibrary.prompt(emailPromptOptions)`), forwards messages to the LLM with streaming, and returns SSE events. On the client, `emailLibrary` maps each OpenUI Lang node to a React Email component that renders progressively as tokens arrive.
+
+The key difference from other examples: the output isn't interactive UI — it's static email content. The split-view editor shows a live preview on the right and formatted HTML on the left, with copy buttons for both the HTML and the subject line.
+
+## Project layout
+
+```
+examples/react-email/
+|- src/app/ # Next.js app (layout, page, API route)
+|- src/components/
+| |- composePage/ # Landing page with conversation starters
+| |- emailEditor/ # Split view (top bar, HTML panel, preview, input)
+| |- loadingDots.tsx # Loading animation (shared)
+| |- session.ts # Session persistence (shared)
+|- src/hooks/ # Theme, clipboard, auto-scroll, email rendering
+|- src/generated/ # Auto-generated system prompt
+
+packages/react-email/
+|- src/components/ # 44 email components (defineComponent)
+|- src/index.ts # Library, groups, examples, rules
+|- src/unions.ts # Component type unions
+```
+
+## Run the example
+
+Run these commands from `examples/react-email`.
+
+1. Install dependencies:
+
+```bash
+cd examples/react-email
+pnpm install
+```
+
+2. Create a `.env.local` file with your API key:
+
+```bash
+OPENAI_API_KEY=sk-...
+```
+
+3. Start the dev server:
+
+```bash
+pnpm dev
+```
+
+This auto-generates the system prompt from the email component library and starts the Next.js dev server.
diff --git a/docs/public/videos/react-email.mp4 b/docs/public/videos/react-email.mp4
new file mode 100644
index 000000000..50aac2dd8
Binary files /dev/null and b/docs/public/videos/react-email.mp4 differ
diff --git a/examples/react-email/.env.example b/examples/react-email/.env.example
new file mode 100644
index 000000000..fd151395e
--- /dev/null
+++ b/examples/react-email/.env.example
@@ -0,0 +1 @@
+OPENAI_API_KEY=sk-your-api-key-here
diff --git a/examples/react-email/README.md b/examples/react-email/README.md
new file mode 100644
index 000000000..e7f5a2856
--- /dev/null
+++ b/examples/react-email/README.md
@@ -0,0 +1,124 @@
+# React Email
+
+AI-powered email generator built with [OpenUI](https://openui.com) and [React Email](https://react.email).
+
+Describe an email in natural language, and the AI generates a live preview with exportable HTML. Iterate on the design through follow-up prompts.
+
+## Features
+
+- **44 email components** — headers, footers, feature grids, pricing cards, checkout tables, testimonials, and more
+- **Live preview** — see the email render in real time as the AI streams its response
+- **Copy HTML** — one-click export of email-client-compatible HTML (pretty-formatted via `@react-email/render`)
+- **Copy subject** — grab the generated subject line
+- **Conversation starters** — pre-built prompts for common email types (OpenUI launch, abandoned cart, conference invite, travel newsletter)
+- **Iterative design** — refine the email through follow-up messages
+- **Dark mode** — automatic system theme detection
+
+## Prerequisites
+
+- Node.js 20+
+- [pnpm](https://pnpm.io/) (this example lives inside the OpenUI monorepo)
+- An [OpenAI API key](https://platform.openai.com/api-keys)
+
+## Getting Started
+
+1. Clone the repo and install dependencies from the monorepo root:
+
+```bash
+git clone https://github.com/thesysdev/openui.git
+cd openui
+pnpm install
+```
+
+2. Copy `.env.example` to `.env.local` and add your OpenAI API key:
+
+```bash
+cp examples/react-email/.env.example examples/react-email/.env.local
+```
+
+Edit `examples/react-email/.env.local`:
+
+```
+OPENAI_API_KEY=sk-your-api-key-here
+```
+
+3. Start the development server:
+
+```bash
+cd examples/react-email
+pnpm dev
+```
+
+The app will be available at [http://localhost:3000](http://localhost:3000).
+
+## Scripts
+
+| Command | Description |
+|---------|-------------|
+| `pnpm dev` | Start dev server (auto-generates system prompt) |
+| `pnpm build` | Production build |
+| `pnpm start` | Start production server |
+| `pnpm lint` | Run ESLint |
+
+## Key Dependencies
+
+| Package | Purpose |
+|---------|---------|
+| `@openuidev/react-email` | 44 email components + system prompt generation |
+| `@openuidev/react-lang` | `Renderer` — parses OpenUI Lang and renders components |
+| `@openuidev/react-headless` | Chat thread state management |
+| `@react-email/components` | Email-compatible HTML primitives |
+| `@react-email/render` | Converts React components to email HTML |
+| `next` | App framework (Next.js 16) |
+| `openai` | OpenAI streaming API client |
+
+## Project Structure
+
+```
+src/
+ app/
+ page.tsx # Main app — compose + editor views
+ layout.tsx # Root layout with theme provider
+ api/chat/route.ts # OpenAI streaming API route
+ components/
+ composePage/
+ index.tsx # Landing page with conversation starters
+ starters.ts # Conversation starter prompts
+ emailEditor/
+ index.tsx # Split view orchestrator
+ topBar.tsx # Header with title + generating indicator
+ htmlPanel.tsx # Left panel — HTML code output
+ previewPanel.tsx # Right panel — live email preview
+ messageInput.tsx # Bottom input form
+ mobileTabToggle.tsx # Mobile HTML/Preview tab switcher
+ loadingDots.tsx # Loading animation (shared)
+ session.ts # Session persistence (shared)
+ hooks/
+ useSystemTheme.tsx # Dark/light theme detection
+ useIsMobile.ts # Responsive breakpoint hook
+ useClipboard.ts # Copy-to-clipboard hook
+ useAutoScroll.ts # Auto-scroll with user override
+ useEmailRendering.tsx # HTML rendering + streaming lifecycle
+ generated/
+ system-prompt.txt # Auto-generated from @openuidev/react-email
+```
+
+## How It Works
+
+1. The system prompt is auto-generated at build time from `@openuidev/react-email`'s `emailLibrary` and `emailPromptOptions`
+2. User describes an email (or clicks a starter)
+3. The AI responds in OpenUI Lang format
+4. The `Renderer` from `@openuidev/react-lang` parses and renders the email components in real time using `emailLibrary`
+5. Once streaming completes, `useEmailRendering` calls `render()` from `@react-email/render` with `{ pretty: true }` client-side to produce copyable, formatted HTML
+
+## What the package provides
+
+The `@openuidev/react-email` package exports:
+
+- **`emailLibrary`** — ready-to-use library with 44 components (pass to `<Renderer>`)
+- **`emailPromptOptions`** — examples + rules for the LLM system prompt
+- **`emailComponentGroups`** — organized component groups with usage notes
+- **`emailExamples`** — 10 example email templates
+- **`emailAdditionalRules`** — 40 email design rules
+
+Individual components are internal to the library — consumers only need `emailLibrary`.
diff --git a/examples/react-email/eslint.config.mjs b/examples/react-email/eslint.config.mjs
new file mode 100644
index 000000000..1745be719
--- /dev/null
+++ b/examples/react-email/eslint.config.mjs
@@ -0,0 +1,22 @@
+import { defineConfig, globalIgnores } from "eslint/config";
+import nextVitals from "eslint-config-next/core-web-vitals";
+import nextTs from "eslint-config-next/typescript";
+
+const eslintConfig = defineConfig([
+ ...nextVitals,
+ ...nextTs,
+ globalIgnores([
+ ".next/**",
+ "out/**",
+ "build/**",
+ "next-env.d.ts",
+ ]),
+ {
+ files: ["src/openui/**/*.{ts,tsx}"],
+ rules: {
+ "react-hooks/rules-of-hooks": "off",
+ },
+ },
+]);
+
+export default eslintConfig;
diff --git a/examples/react-email/next-env.d.ts b/examples/react-email/next-env.d.ts
new file mode 100644
index 000000000..c4b7818fb
--- /dev/null
+++ b/examples/react-email/next-env.d.ts
@@ -0,0 +1,6 @@
+/// <reference types="next" />
+/// <reference types="next/image-types/global" />
+import "./.next/dev/types/routes.d.ts";
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/examples/react-email/next.config.ts b/examples/react-email/next.config.ts
new file mode 100644
index 000000000..2e05f77a3
--- /dev/null
+++ b/examples/react-email/next.config.ts
@@ -0,0 +1,11 @@
+import type { NextConfig } from "next";
+
+const nextConfig: NextConfig = {
+ transpilePackages: [
+ "@openuidev/react-headless",
+ "@openuidev/react-lang",
+ "@openuidev/react-email",
+ ],
+};
+
+export default nextConfig;
diff --git a/examples/react-email/package.json b/examples/react-email/package.json
new file mode 100644
index 000000000..b653e92a7
--- /dev/null
+++ b/examples/react-email/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "react-email-example",
+ "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "generate:prompt": "node --import tsx -e \"import{emailLibrary,emailPromptOptions}from'@openuidev/react-email';import{writeFileSync,mkdirSync}from'fs';mkdirSync('src/generated',{recursive:true});writeFileSync('src/generated/system-prompt.txt',emailLibrary.prompt(emailPromptOptions));console.log('Prompt generated')\"",
+ "dev": "pnpm generate:prompt && next dev",
+ "build": "pnpm generate:prompt && next build",
+ "start": "next start",
+ "lint": "eslint"
+ },
+ "dependencies": {
+ "@openuidev/cli": "workspace:*",
+ "@openuidev/react-email": "workspace:*",
+ "@openuidev/react-headless": "workspace:*",
+ "@openuidev/react-lang": "workspace:*",
+ "@react-email/components": "^0.0.41",
+ "@react-email/render": "^1.0.6",
+ "next": "16.1.6",
+ "openai": "^6.22.0",
+ "react": "19.2.3",
+ "lucide-react": "^0.562.0",
+ "react-dom": "19.2.3"
+ },
+ "devDependencies": {
+ "@tailwindcss/postcss": "^4",
+ "@types/node": "^20",
+ "@types/react": "^19",
+ "@types/react-dom": "^19",
+ "eslint": "^9",
+ "eslint-config-next": "16.1.6",
+ "tailwindcss": "^4",
+ "tsx": "^4.19.2",
+ "typescript": "^5"
+ }
+}
diff --git a/examples/react-email/postcss.config.mjs b/examples/react-email/postcss.config.mjs
new file mode 100644
index 000000000..61e36849c
--- /dev/null
+++ b/examples/react-email/postcss.config.mjs
@@ -0,0 +1,7 @@
+const config = {
+ plugins: {
+ "@tailwindcss/postcss": {},
+ },
+};
+
+export default config;
diff --git a/examples/react-email/src/app/api/chat/route.ts b/examples/react-email/src/app/api/chat/route.ts
new file mode 100644
index 000000000..3e8020545
--- /dev/null
+++ b/examples/react-email/src/app/api/chat/route.ts
@@ -0,0 +1,92 @@
+import { readFileSync } from "fs";
+import { NextRequest } from "next/server";
+import OpenAI from "openai";
+import type { ChatCompletionMessageParam } from "openai/resources/chat/completions.mjs";
+import { join } from "path";
+
+const systemPrompt = readFileSync(join(process.cwd(), "src/generated/system-prompt.txt"), "utf-8");
+
+export async function POST(req: NextRequest) {
+ const { messages } = await req.json();
+
+ const client = new OpenAI({
+ apiKey: process.env.OPENAI_API_KEY,
+ });
+
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const cleanMessages = (messages as any[])
+ .filter((m) => m.role !== "tool")
+ .map((m) => {
+ if (m.role === "assistant" && m.tool_calls?.length) {
+ const { tool_calls: _tc, ...rest } = m; // eslint-disable-line @typescript-eslint/no-unused-vars
+ return rest;
+ }
+ return m;
+ });
+
+ const chatMessages: ChatCompletionMessageParam[] = [
+ { role: "system", content: systemPrompt },
+ ...cleanMessages,
+ ];
+
+ const stream = await client.chat.completions.create({
+ model: "gpt-5.4",
+ messages: chatMessages,
+ stream: true,
+ });
+
+ const encoder = new TextEncoder();
+ let controllerClosed = false;
+
+ const readable = new ReadableStream({
+ async start(controller) {
+ const enqueue = (data: Uint8Array) => {
+ if (controllerClosed) return;
+ try {
+ controller.enqueue(data);
+ } catch {
+ /* already closed */
+ }
+ };
+ const close = () => {
+ if (controllerClosed) return;
+ controllerClosed = true;
+ try {
+ controller.close();
+ } catch {
+ /* already closed */
+ }
+ };
+
+ try {
+ for await (const chunk of stream) {
+ const choice = chunk.choices?.[0];
+ const delta = choice?.delta;
+
+ // Only send chunks that have content or signal completion
+ if (delta?.content) {
+ enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
+ }
+ if (choice?.finish_reason === "stop") {
+ enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
+ }
+ }
+ } catch (err) {
+ const msg = err instanceof Error ? err.message : "Stream error";
+ console.error("Chat route error:", msg);
+ enqueue(encoder.encode(`data: ${JSON.stringify({ error: msg })}\n\n`));
+ } finally {
+ enqueue(encoder.encode("data: [DONE]\n\n"));
+ close();
+ }
+ },
+ });
+
+ return new Response(readable, {
+ headers: {
+ "Content-Type": "text/event-stream",
+ "Cache-Control": "no-cache, no-transform",
+ Connection: "keep-alive",
+ },
+ });
+}
diff --git a/examples/react-email/src/app/globals.css b/examples/react-email/src/app/globals.css
new file mode 100644
index 000000000..619ce4395
--- /dev/null
+++ b/examples/react-email/src/app/globals.css
@@ -0,0 +1,14 @@
+@import "tailwindcss";
+
+/* Placeholder color for compose textarea */
+textarea::placeholder,
+input::placeholder {
+ color: #6B7280 !important;
+ opacity: 1;
+}
+
+[data-theme="dark"] textarea::placeholder,
+[data-theme="dark"] input::placeholder {
+ color: #4B5563 !important;
+ opacity: 1;
+}
diff --git a/examples/react-email/src/app/layout.tsx b/examples/react-email/src/app/layout.tsx
new file mode 100644
index 000000000..3ecaab52b
--- /dev/null
+++ b/examples/react-email/src/app/layout.tsx
@@ -0,0 +1,19 @@
+import type { Metadata } from "next";
+import "./globals.css";
+
+export const metadata: Metadata = {
+ title: "Email Generator",
+ description: "AI-powered email generator with OpenUI and React Email",
+};
+
+export default function RootLayout({
+ children,
+}: Readonly<{
+ children: React.ReactNode;
+}>) {
+ return (
+ <html lang="en">
+ <body>{children}</body>
+ </html>
+ );
+}
diff --git a/examples/react-email/src/app/page.tsx b/examples/react-email/src/app/page.tsx
new file mode 100644
index 000000000..baf037f3d
--- /dev/null
+++ b/examples/react-email/src/app/page.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import { useCallback, useEffect, useRef, useState } from "react";
+import {
+ ChatProvider,
+ openAIAdapter,
+ openAIMessageFormat,
+ useThread,
+} from "@openuidev/react-headless";
+
+import { ComposePage } from "@/components/composePage";
+import { EmailEditor } from "@/components/emailEditor";
+import {
+ saveView,
+ loadView,
+ saveMessages,
+ loadMessages,
+ clearSession,
+} from "@/components/session";
+
+// ── Main App (manages view state) ──
+
+function EmailApp() {
+ const [view, setView] = useState<"compose" | "chat">("compose");
+ const messages = useThread((s) => s.messages);
+ const processMessage = useThread((s) => s.processMessage);
+ const setMessages = useThread((s) => s.setMessages);
+ const restoredRef = useRef<boolean | null>(null);
+
+ // Restore view and messages synchronously on first render (not in effect)
+ if (restoredRef.current === null) {
+ restoredRef.current = true;
+ const savedView = loadView();
+ if (savedView === "chat") setView("chat");
+ const saved = loadMessages();
+ if (saved && saved.length > 0) {
+ setMessages(saved as Parameters<typeof setMessages>[0]);
+ }
+ }
+
+ // Persist messages to session whenever they change
+ useEffect(() => {
+ if (messages.length > 0) {
+ saveMessages(messages);
+ }
+ }, [messages]);
+
+ const handleSend = useCallback(
+ (message: string) => {
+ setView("chat");
+ saveView("chat");
+ processMessage({ role: "user", content: message });
+ },
+ [processMessage]
+ );
+
+ const handleNewEmail = useCallback(() => {
+ setMessages([]);
+ setView("compose");
+ clearSession();
+ }, [setMessages]);
+
+ if (view === "compose") {
+ return <ComposePage onSend={handleSend} />;
+ }
+
+ return <EmailEditor onNewEmail={handleNewEmail} />;
+}
+
+// ── Page Root ──
+
+export default function Page() {
+ return (
+ <div style={{ height: "100vh", width: "100vw", overflow: "hidden" }}>
+ <ChatProvider
+ processMessage={async ({ messages, abortController }) => {
+ return fetch("/api/chat", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ messages: openAIMessageFormat.toApi(messages),
+ }),
+ signal: abortController.signal,
+ });
+ }}
+ streamProtocol={openAIAdapter()}
+ >
+ <EmailApp />
+ </ChatProvider>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/composePage/index.tsx b/examples/react-email/src/components/composePage/index.tsx
new file mode 100644
index 000000000..23581a8f0
--- /dev/null
+++ b/examples/react-email/src/components/composePage/index.tsx
@@ -0,0 +1,225 @@
+"use client";
+
+import { useIsMobile } from "@/hooks/useIsMobile";
+import { Send as SendIcon } from "lucide-react";
+import { useState } from "react";
+import { STARTERS } from "./starters";
+
+export function ComposePage({ onSend }: { onSend: (message: string) => void }) {
+ const [input, setInput] = useState("");
+ const isDark = true;
+ const isMobile = useIsMobile();
+
+ const handleSubmit = (e: React.FormEvent) => {
+ e.preventDefault();
+ if (!input.trim()) return;
+ onSend(input.trim());
+ setInput("");
+ };
+
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ handleSubmit(e);
+ }
+ };
+
+ return (
+ <div
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ height: "100%",
+ padding: isMobile ? "16px" : "24px",
+ gap: isMobile ? "24px" : "32px",
+ backgroundColor: isDark ? "#0a0a0a" : "#fafafa",
+ overflow: "auto",
+ }}
+ >
+ {/* Heading */}
+ <div style={{ textAlign: "center", maxWidth: isMobile ? "100%" : undefined }}>
+ <h1
+ style={{
+ fontSize: isMobile ? "28px" : "48px",
+ fontWeight: 700,
+ color: isDark ? "#f5f5f5" : "#111827",
+ margin: "0 0 12px 0",
+ letterSpacing: "-0.03em",
+ lineHeight: 1.1,
+ }}
+ >
+ AI email generator
+ </h1>
+ <p
+ style={{
+ fontSize: isMobile ? "14px" : "17px",
+ color: isDark ? "#9CA3AF" : "#6B7280",
+ margin: 0,
+ lineHeight: 1.5,
+ }}
+ >
+ {isMobile
+ ? "Turn a prompt into a complete email template."
+ : "Turn a simple prompt into a complete email template with layout, copy, and CTAs included."}
+ </p>
+ </div>
+
+ {/* Conversation starters — responsive grid */}
+ <div
+ style={{
+ display: "grid",
+ gridTemplateColumns: isMobile ? "repeat(2, 1fr)" : "repeat(4, 1fr)",
+ gap: isMobile ? "8px" : "12px",
+ maxWidth: "700px",
+ width: "100%",
+ }}
+ >
+ {STARTERS.map((starter) => (
+ <button
+ key={starter.prompt}
+ onClick={() => onSend(starter.prompt)}
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "flex-start",
+ justifyContent: "space-between",
+ padding: isMobile ? "12px" : "16px",
+ minHeight: isMobile ? "100px" : "140px",
+ borderRadius: isMobile ? "12px" : "16px",
+ border: `1px solid ${isDark ? "#222" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#111111" : "#ffffff",
+ cursor: "pointer",
+ transition: "border-color 0.2s, transform 0.15s",
+ textAlign: "left",
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = isDark ? "#444" : "#d1d5db";
+ e.currentTarget.style.transform = "translateY(-2px)";
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = isDark ? "#222" : "#e5e7eb";
+ e.currentTarget.style.transform = "translateY(0)";
+ }}
+ >
+ <div
+ style={{
+ width: isMobile ? 28 : 36,
+ height: isMobile ? 28 : 36,
+ borderRadius: isMobile ? "8px" : "10px",
+ backgroundColor: isDark ? starter.iconBg : "#f3f4f6",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ fontSize: isMobile ? "14px" : "18px",
+ marginBottom: isMobile ? "10px" : "16px",
+ }}
+ >
+ {starter.icon}
+ </div>
+ <span
+ style={{
+ fontSize: isMobile ? "12px" : "14px",
+ fontWeight: 500,
+ color: isDark ? "#e5e7eb" : "#111827",
+ lineHeight: "1.4",
+ }}
+ >
+ {starter.displayText}
+ </span>
+ </button>
+ ))}
+ </div>
+
+ {/* Textarea input */}
+ <form
+ onSubmit={handleSubmit}
+ style={{
+ position: "relative",
+ width: "100%",
+ maxWidth: "700px",
+ }}
+ >
+ <div
+ style={{
+ borderRadius: isMobile ? "12px" : "16px",
+ border: `1px solid ${isDark ? "#1f1f1f" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#111111" : "#ffffff",
+ overflow: "hidden",
+ transition: "border-color 0.2s, box-shadow 0.2s",
+ }}
+ >
+ <textarea
+ value={input}
+ onChange={(e) => setInput(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder={
+ isMobile
+ ? "Describe the email you want..."
+ : `Create a product launch email for our new [product], highlight 3 key features, and add a "Shop now" button.`
+ }
+ rows={isMobile ? 3 : 4}
+ style={{
+ width: "100%",
+ padding: isMobile ? "14px 14px 40px 14px" : "20px 20px 48px 20px",
+ fontSize: isMobile ? "14px" : "15px",
+ lineHeight: "1.6",
+ border: "none",
+ backgroundColor: "transparent",
+ color: isDark ? "#f5f5f5" : "#111827",
+ outline: "none",
+ boxSizing: "border-box",
+ resize: "none",
+ fontFamily: "inherit",
+ }}
+ onFocus={(e) => {
+ const container = e.currentTarget.parentElement;
+ if (container) {
+ container.style.borderColor = "#5F51E8";
+ container.style.boxShadow = isDark
+ ? "0 0 0 1px #5F51E8"
+ : "0 0 0 3px rgba(95, 81, 232, 0.1)";
+ }
+ }}
+ onBlur={(e) => {
+ const container = e.currentTarget.parentElement;
+ if (container) {
+ container.style.borderColor = isDark ? "#1f1f1f" : "#e5e7eb";
+ container.style.boxShadow = "none";
+ }
+ }}
+ />
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "flex-end",
+ padding: "0 10px 10px 10px",
+ }}
+ >
+ <button
+ type="submit"
+ style={{
+ width: "36px",
+ height: "36px",
+ borderRadius: "50%",
+ border: "none",
+ backgroundColor: input.trim() ? "#5F51E8" : isDark ? "#1a1a1a" : "#f3f4f6",
+ cursor: input.trim() ? "pointer" : "default",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ transition: "background-color 0.2s",
+ }}
+ >
+ <SendIcon
+ size={16}
+ color={input.trim() ? "#ffffff" : isDark ? "#4B5563" : "#9CA3AF"}
+ />
+ </button>
+ </div>
+ </div>
+ </form>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/composePage/starters.ts b/examples/react-email/src/components/composePage/starters.ts
new file mode 100644
index 000000000..d94c94bf6
--- /dev/null
+++ b/examples/react-email/src/components/composePage/starters.ts
@@ -0,0 +1,162 @@
+export const STARTERS = [
+ {
+ icon: "\uD83D\uDE80",
+ iconBg: "#1a1a3e",
+ displayText: "OpenUI launch announcement",
+ prompt: `Create a beautiful launch announcement email for OpenUI — the open standard for Generative UI. OpenUI lets AI respond with real UI components instead of plain text. Use teal (#50D4E2) as the accent color. Make it developer-focused, polished, and comprehensive.
+
+Include these sections in order:
+
+1. EmailHeaderCenteredNav with logo (https://www.openui.com/favicon.svg, "OpenUI", height 42) and 3 nav links: "Documentation", "GitHub", "Examples"
+2. EmailDivider
+3. EmailImage hero banner (https://www.openui.com/meta-image.png, "OpenUI — The Open Standard for Generative UI", 600)
+4. EmailHeading "The Open Standard for Generative UI" (level 1)
+5. EmailText "Stop building chat UIs that only return plain text. OpenUI lets your AI respond with real, interactive components — forms, charts, cards, tables, and more. Define your components once, and any LLM can render them."
+6. EmailButton "Get Started — npx @openuidev/cli create" linking to https://www.openui.com with color #50D4E2
+7. EmailDivider
+8. EmailHeading "Why developers choose OpenUI" (level 2)
+9. EmailText "OpenUI is up to 3x faster rendering than JSON-based approaches, uses up to 67% fewer tokens, and works with any LLM provider."
+10. EmailDivider
+11. EmailStats with 3 items: ("3x", "Faster Rendering"), ("67%", "Fewer Tokens"), ("0", "Arbitrary Code Execution")
+12. EmailDivider
+13. EmailFeatureGrid titled "Built for the modern AI stack" with description "Everything you need to ship generative UI experiences." and 4 items:
+ - (https://react.dev/favicon-32x32.png, "React", "React Components", "40+ production-ready components with defineComponent and Zod-powered type safety.")
+ - (https://openai.com/favicon.ico, "AI", "Any LLM Provider", "OpenAI, Anthropic, Gemini, Mistral — works with any OpenAI-compatible API.")
+ - (https://www.typescriptlang.org/favicon-32x32.png, "TypeScript", "OpenUI Lang", "A specialized format that LLMs generate natively — no JSON parsing, no prompt hacks.")
+ - (https://vercel.com/favicon.ico, "Deploy", "Chat SDK Included", "Drop-in Copilot, FullScreen, and BottomTray layouts with streaming and persistence.")
+14. EmailDivider
+15. EmailCodeBlock with this code:
+ "import { defineComponent } from '@openuidev/react-lang';\\nimport { z } from 'zod';\\n\\nexport const WeatherCard = defineComponent({\\n name: 'WeatherCard',\\n props: z.object({\\n city: z.string(),\\n temp: z.number(),\\n condition: z.string(),\\n }),\\n description: 'Shows current weather for a city',\\n component: ({ props }) => (\\n <div>\\n <h3>{props.city}</h3>\\n <p>{props.temp}° — {props.condition}</p>\\n </div>\\n ),\\n});"
+ with language "typescript"
+16. EmailDivider
+17. EmailFeatureList titled "How OpenUI works" with description "From component definition to rendered UI in 4 steps." and 3 items:
+ - (https://www.openui.com/favicon.svg, "Define", "Define your components", "Register components with defineComponent and Zod schemas. OpenUI generates the system prompt automatically.")
+ - (https://www.openui.com/favicon.svg, "Generate", "LLM generates OpenUI Lang", "The AI responds in a lightweight, token-efficient format purpose-built for UI generation.")
+ - (https://www.openui.com/favicon.svg, "Render", "Render in real-time", "The Renderer parses and displays components with streaming support — no flash of empty content.")
+18. EmailDivider
+19. EmailList titled "Get started in 3 steps" with 3 items:
+ - "Scaffold your project" / "Run npx @openuidev/cli create to set up a new project with React, TypeScript, and your choice of LLM provider."
+ - "Define your component library" / "Use defineComponent with Zod schemas. Group them with createLibrary. OpenUI handles the system prompt."
+ - "Connect and ship" / "Point to any OpenAI-compatible API. Drop in a Chat layout or use the headless useChat hook. Deploy anywhere."
+20. EmailDivider
+21. EmailPricingCard with badge "OPEN SOURCE", price "$0", period "/ forever", description "OpenUI is fully open source under MIT license. No vendor lock-in, no usage limits, no enterprise gates.", features: "Unlimited components & libraries", "All LLM providers supported", "Commercial use — MIT license", "Community support on GitHub & Discord", button "Star on GitHub" with href https://github.com/thesysdev/openui and color #50D4E2
+22. EmailTestimonial with quote "OpenUI completely changed how we build AI features. We went from fragile JSON parsing to a type-safe component system in a weekend. The token savings alone made it worth switching.", avatar (https://picsum.photos/seed/dev-testimonial/100/100, "Alex Rivera"), name "Alex Rivera", role "Staff Engineer at Vercel"
+24. EmailDivider
+25. EmailCustomerReview titled "Loved by developers" with totalReviews 2800, rating5: 2240, rating4: 392, rating3: 112, rating2: 28, rating1: 28, button "Leave a Review", href https://github.com/thesysdev/openui, color #50D4E2
+27. EmailSurveyRating with question "How was your experience with OpenUI?" and description "Your feedback helps us build a better developer tool." and color #50D4E2
+31. EmailDivider
+32. EmailFooterCentered with logo (https://www.openui.com/favicon.svg, "OpenUI"), company "OpenUI", tagline "The open standard for Generative UI", address "Built by Thesys · San Francisco, CA", contact "[email protected]", and 3 social icons:
+ - (https://react.email/static/facebook-logo.png, "Facebook", https://facebook.com/openui)
+ - (https://react.email/static/x-logo.png, "X", https://x.com/thesaboratorio)
+ - (https://react.email/static/instagram-logo.png, "Instagram", https://instagram.com/openui)`,
+ },
+ {
+ icon: "\uD83D\uDED2",
+ iconBg: "#2e1a1e",
+ displayText: "Abandoned cart reminder",
+ prompt: `Create a beautiful abandoned cart email for a premium e-commerce brand called "Lumière". Use warm gold (#D4A574) as the accent color. Make it elegant, product-focused, and persuasive.
+
+Include these sections in order:
+
+1. EmailHeaderSideNav with logo (https://picsum.photos/seed/lumiere-logo/150/42, "Lumière", height 42) and 3 nav links: "New Arrivals", "Bestsellers", "Sale"
+2. EmailDivider
+3. EmailHeading "You left something beautiful behind" (level 1)
+4. EmailText "Hi there — your cart is waiting. These handcrafted pieces won't be available forever. Complete your order before they're gone."
+5. EmailDivider
+6. EmailCheckoutTable titled "Your Cart" with 3 items and button "Complete Your Order" with href https://lumiere.com/cart and color #D4A574:
+ - (https://images.unsplash.com/photo-1524592094714-0f0654e20314?w=100&h=100&fit=crop, "Gold Watch", "Artisan Gold Watch", 1, "$420.00")
+ - (https://images.unsplash.com/photo-1548036328-c9fa89d128fa?w=100&h=100&fit=crop, "Leather Bag", "Italian Leather Tote", 1, "$285.00")
+ - (https://images.unsplash.com/photo-1606760227091-3dd870d97f1d?w=100&h=100&fit=crop, "Silk Scarf", "Hand-painted Silk Scarf", 2, "$95.00")
+7. EmailDivider
+8. EmailProductCard with image (https://images.unsplash.com/photo-1524592094714-0f0654e20314?w=600&h=320&fit=crop, "Artisan Gold Watch"), category "BESTSELLER", title "Artisan Gold Watch", description "Hand-assembled in our Geneva atelier. Swiss movement, sapphire crystal, and a 5-year warranty. Each piece is numbered and unique.", price "$420.00", button "Shop Now", href https://lumiere.com/products/gold-watch, color #D4A574
+9. EmailDivider
+10. EmailImageGrid titled "You might also love" with description "Curated picks based on your style." and 4 images:
+ - (https://images.unsplash.com/photo-1611591437281-460bfbe1220a?w=300&h=288&fit=crop, "Gold Bracelet")
+ - (https://images.unsplash.com/photo-1541643600914-78b084683601?w=300&h=288&fit=crop, "Signature Perfume")
+ - (https://images.unsplash.com/photo-1572635196237-14b3f281503f?w=300&h=288&fit=crop, "Designer Sunglasses")
+ - (https://images.unsplash.com/photo-1535632066927-ab7c9ab60908?w=300&h=288&fit=crop, "Pearl Earrings")
+11. EmailDivider
+12. EmailTestimonial with quote "The craftsmanship is exceptional. I've received more compliments on my Lumière watch than anything I've ever owned. Worth every penny.", avatar (https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100&h=100&fit=crop, "Emma Laurent"), name "Emma Laurent", role "Verified Buyer · Paris"
+13. EmailDivider
+14. EmailButton "Complete Your Order — Free Shipping" linking to https://lumiere.com/cart with color #D4A574
+15. EmailDivider
+16. EmailFooterCentered with logo (https://picsum.photos/seed/lumiere-icon/42/42, "Lumière"), company "Lumière", tagline "Crafted with intention", address "Lumière · 12 Rue du Faubourg Saint-Honoré · Paris, 75008", contact "[email protected]", and 3 social icons:
+ - (https://react.email/static/facebook-logo.png, "Facebook", https://facebook.com/lumiere)
+ - (https://react.email/static/x-logo.png, "X", https://x.com/lumiere)
+ - (https://react.email/static/instagram-logo.png, "Instagram", https://instagram.com/lumiere)`,
+ },
+ {
+ icon: "\uD83C\uDF9F\uFE0F",
+ iconBg: "#1a2e1e",
+ displayText: "Tech conference invitation",
+ prompt: `Create an exciting tech conference invitation email for "DevSummit 2026" — a 2-day developer conference. Use electric purple (#7C3AED) as the accent color. Make it bold, energetic, and information-rich.
+
+Include these sections in order:
+
+1. EmailHeaderCenteredNav with logo (https://picsum.photos/seed/devsummit-logo/150/42, "DevSummit 2026", height 42) and 3 nav links: "Speakers", "Schedule", "Tickets"
+2. EmailDivider
+3. EmailImage hero (https://images.unsplash.com/photo-1540575467063-178a50c2df87?w=600&h=300&fit=crop, "DevSummit 2026 — March 15-16, San Francisco", 600)
+4. EmailHeading "DevSummit 2026 — You're Invited" (level 1)
+5. EmailText "Join 3,000+ developers, founders, and tech leaders for two days of talks, workshops, and networking at the Moscone Center in San Francisco. Early bird pricing ends soon."
+6. EmailButton "Get Your Ticket" linking to https://devsummit.dev/tickets with color #7C3AED
+7. EmailDivider
+8. EmailStats with 3 items: ("50+", "Speakers"), ("3,000+", "Attendees"), ("2", "Days")
+9. EmailDivider
+10. EmailFeatureGrid titled "What to Expect" with description "Two days packed with insights, hands-on workshops, and connections." and 4 items:
+ - (https://images.unsplash.com/photo-1475721027785-f74eccf877e2?w=48&h=48&fit=crop, "Keynotes", "World-Class Keynotes", "Hear from engineering leaders at Vercel, Stripe, Linear, and more.")
+ - (https://images.unsplash.com/photo-1517694712202-14dd9538aa97?w=48&h=48&fit=crop, "Workshops", "Hands-on Workshops", "Build real projects with AI, React Server Components, and edge computing.")
+ - (https://images.unsplash.com/photo-1529070538774-1843cb3265df?w=48&h=48&fit=crop, "Networking", "Networking Events", "Evening mixers, 1:1 mentoring sessions, and the legendary after-party.")
+ - (https://images.unsplash.com/photo-1559136555-9303baea8ebd?w=48&h=48&fit=crop, "Expo", "Startup Expo", "Meet 40+ startups showcasing cutting-edge developer tools.")
+11. EmailDivider
+12. EmailList titled "Featured Speakers" with 3 items:
+ - "Sarah Drasner" / "VP of Developer Experience at Netlify. Keynote on the future of web development and AI-assisted coding."
+ - "Guillermo Rauch" / "CEO of Vercel. Talk on the evolution of React and what's next for the framework ecosystem."
+ - "Lea Verou" / "W3C TAG member. Workshop on modern CSS techniques that will change how you build interfaces."
+13. EmailDivider
+14. EmailPricingCard with badge "EARLY BIRD", price "$299", period "/ person", description "Full access to all talks, workshops, networking events, meals, and the after-party. Group discounts available for teams of 5+.", features: "All keynotes & sessions", "Hands-on workshop access", "Networking mixer + after-party", "Lunch & refreshments both days", button "Claim Early Bird Price" with href https://devsummit.dev/tickets and color #7C3AED
+15. EmailDivider
+16. EmailSurveyRating with question "Interested in attending?" and description "Rate your interest and we'll send you updates." and color #7C3AED
+17. EmailDivider
+18. EmailFooterCentered with logo (https://picsum.photos/seed/devsummit-icon/42/42, "DevSummit"), company "DevSummit", tagline "Where developers connect", address "Moscone Center · 747 Howard St · San Francisco, CA 94103", contact "[email protected]", and 3 social icons:
+ - (https://react.email/static/facebook-logo.png, "Facebook", https://facebook.com/devsummit)
+ - (https://react.email/static/x-logo.png, "X", https://x.com/devsummit)
+ - (https://react.email/static/instagram-logo.png, "Instagram", https://instagram.com/devsummit)`,
+ },
+ {
+ icon: "\u2708\uFE0F",
+ iconBg: "#2e1a1a",
+ displayText: "Travel marketplace newsletter",
+ prompt: `Create a warm, beautiful travel marketplace newsletter email for an Airbnb-like platform called "Wanderly". Use coral (#FF5A5F) as the accent color. Make it image-rich, friendly, and inspiring.
+
+Include these sections in order:
+
+1. EmailHeaderCenteredNav with logo (https://picsum.photos/seed/wanderly-logo/150/42, "Wanderly", height 42) and 3 nav links: "Explore", "Stays", "Experiences"
+2. EmailDivider
+3. EmailHeading "Your Week in Travel" (level 1)
+4. EmailText "Handpicked destinations, trending stays, and exclusive deals — curated just for you. Here's what's inspiring travelers this week."
+5. EmailDivider
+6. EmailImageGrid titled "Trending Destinations" with description "The most-booked places by Wanderly travelers this month." and 4 images:
+ - (https://picsum.photos/seed/santorini-blue/300/288, "Santorini, Greece")
+ - (https://picsum.photos/seed/kyoto-temple/300/288, "Kyoto, Japan")
+ - (https://picsum.photos/seed/maldives-ocean/300/288, "Maldives")
+ - (https://picsum.photos/seed/swiss-alps-snow/300/288, "Swiss Alps")
+7. EmailDivider
+8. EmailArticle with image (https://picsum.photos/seed/ocean-villa-sunset/600/320, "Ocean Villa at Sunset"), category "FEATURED STAY", title "Cliffside Ocean Villa in Santorini", description "Wake up to panoramic views of the Aegean Sea from your private infinity pool. This stunning 3-bedroom villa features hand-carved stone interiors, a sun-drenched terrace, and direct access to a secluded beach.", button "Book Now — $285/night", href https://wanderly.com/stays/santorini-villa, color #FF5A5F
+9. EmailDivider
+10. EmailList titled "Top 3 Picks This Week" with 3 items:
+ - "Amalfi Coast, Italy" / "Lemon groves, pastel villages, and the best pasta you'll ever eat. Prices drop 20% in shoulder season."
+ - "Bali Rice Terraces" / "Ubud's emerald rice paddies are peak magic right now. Book a treehouse stay for the full experience."
+ - "Northern Lights, Iceland" / "Aurora season peaks this month. Glass-roof cabins are selling out — don't wait."
+11. EmailDivider
+12. EmailStats with 3 items: ("2M+", "Stays Booked"), ("190", "Countries"), ("4.8★", "Avg Rating")
+16. EmailDivider
+17. EmailSurveyRating with question "How was your last trip?" and description "Your feedback helps us find better stays for you." and color #FF5A5F
+18. EmailDivider
+19. EmailTestimonial with quote "Wanderly found us a hidden gem in Tuscany that wasn't on any other platform. The host left homemade limoncello and a handwritten welcome note. Absolute magic.", avatar (https://picsum.photos/seed/guest-james/100/100, "James Mitchell"), name "James Mitchell", role "Verified Guest · Tuscany 2025"
+20. EmailDivider
+21. EmailFooterCentered with logo (https://picsum.photos/seed/wanderly-icon/42/42, "Wanderly"), company "Wanderly", tagline "Find your next adventure", address "Wanderly Inc · 888 Brannan St · San Francisco, CA 94103", contact "[email protected]", and 3 social icons:
+ - (https://react.email/static/facebook-logo.png, "Facebook", https://facebook.com/wanderly)
+ - (https://react.email/static/x-logo.png, "X", https://x.com/wanderly)
+ - (https://react.email/static/instagram-logo.png, "Instagram", https://instagram.com/wanderly)`,
+ },
+];
diff --git a/examples/react-email/src/components/emailEditor/htmlPanel.tsx b/examples/react-email/src/components/emailEditor/htmlPanel.tsx
new file mode 100644
index 000000000..f7c91300e
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/htmlPanel.tsx
@@ -0,0 +1,131 @@
+"use client";
+
+import { Check as CheckIcon, Copy as CopyIcon } from "lucide-react";
+import { LoadingDots } from "../loadingDots";
+
+interface HtmlPanelProps {
+ isDark: boolean;
+ isMobile: boolean;
+ isStreaming: boolean;
+ renderedHtml: string | null;
+ htmlLoading: boolean;
+ copied: boolean;
+ onCopy: () => void;
+}
+
+export function HtmlPanel({
+ isDark,
+ isMobile,
+ isStreaming,
+ renderedHtml,
+ htmlLoading,
+ copied,
+ onCopy,
+}: HtmlPanelProps) {
+ return (
+ <div
+ style={{
+ width: isMobile ? "100%" : "45%",
+ flexShrink: 0,
+ backgroundColor: isDark ? "#0a0a0a" : "#fafafa",
+ borderRight: isMobile ? "none" : `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ display: "flex",
+ flexDirection: "column",
+ overflow: "hidden",
+ }}
+ >
+ {/* Header */}
+ <div
+ style={{
+ padding: "12px 20px",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ flexShrink: 0,
+ borderBottom: `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ }}
+ >
+ <div style={{ display: "flex", alignItems: "center", gap: "8px" }}>
+ <span
+ style={{
+ fontSize: "12px",
+ fontWeight: 600,
+ color: isDark ? "#6B7280" : "#9CA3AF",
+ textTransform: "uppercase",
+ letterSpacing: "0.05em",
+ }}
+ >
+ HTML
+ </span>
+ {htmlLoading && (
+ <span style={{ fontSize: "11px", color: isDark ? "#818cf8" : "#5F51E8" }}>
+ Rendering...
+ </span>
+ )}
+ </div>
+ {renderedHtml && (
+ <button
+ onClick={onCopy}
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: "5px",
+ padding: "5px 12px",
+ fontSize: "12px",
+ fontWeight: 500,
+ borderRadius: "8px",
+ border: "none",
+ backgroundColor: copied ? "#16a34a" : isDark ? "#1f1f1f" : "#f3f4f6",
+ color: copied ? "#ffffff" : isDark ? "#e5e7eb" : "#374151",
+ cursor: "pointer",
+ transition: "all 0.2s",
+ }}
+ >
+ {copied ? (
+ <CheckIcon size={12} color="#ffffff" />
+ ) : (
+ <CopyIcon size={12} color={isDark ? "#e5e7eb" : "#374151"} />
+ )}
+ {copied ? "Copied!" : "Copy"}
+ </button>
+ )}
+ </div>
+
+ {/* Content */}
+ <div style={{ flex: 1, overflow: "auto", padding: "16px 20px" }}>
+ {renderedHtml ? (
+ <pre
+ style={{
+ margin: 0,
+ fontSize: "12px",
+ lineHeight: "1.7",
+ fontFamily: "ui-monospace, 'Cascadia Code', 'Fira Code', 'Courier New', monospace",
+ color: isDark ? "#d4d4d4" : "#374151",
+ whiteSpace: "pre-wrap",
+ wordBreak: "break-word",
+ }}
+ >
+ <code>{renderedHtml}</code>
+ </pre>
+ ) : isStreaming ? (
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: "8px",
+ color: isDark ? "#6B7280" : "#9CA3AF",
+ fontSize: "13px",
+ }}
+ >
+ <LoadingDots color={isDark ? "#818cf8" : "#5F51E8"} />
+ <span>Waiting for email to complete...</span>
+ </div>
+ ) : (
+ <span style={{ color: isDark ? "#4B5563" : "#D1D5DB", fontSize: "13px" }}>
+ HTML will appear here once the email is generated.
+ </span>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/emailEditor/index.tsx b/examples/react-email/src/components/emailEditor/index.tsx
new file mode 100644
index 000000000..4e0598eb2
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/index.tsx
@@ -0,0 +1,116 @@
+"use client";
+
+import { useAutoScroll } from "@/hooks/useAutoScroll";
+import { useClipboard } from "@/hooks/useClipboard";
+import { useEmailRendering } from "@/hooks/useEmailRendering";
+import { useIsMobile } from "@/hooks/useIsMobile";
+import { useThread } from "@openuidev/react-headless";
+import { useMemo, useState } from "react";
+import { HtmlPanel } from "./htmlPanel";
+import { MessageInput } from "./messageInput";
+import { MobileTabToggle } from "./mobileTabToggle";
+import { PreviewPanel } from "./previewPanel";
+import { TopBar } from "./topBar";
+
+export function EmailEditor({ onNewEmail }: { onNewEmail: () => void }) {
+ const [input, setInput] = useState("");
+ const isDark = true;
+ const isMobile = useIsMobile();
+ const [mobileTab, setMobileTab] = useState<"html" | "preview">("preview");
+
+ const messages = useThread((s) => s.messages);
+ const isRunning = useThread((s) => s.isRunning);
+ const processMessage = useThread((s) => s.processMessage);
+
+ const lastAssistantMessage = useMemo(() => {
+ for (let i = messages.length - 1; i >= 0; i--) {
+ if (messages[i]?.role === "assistant") return messages[i];
+ }
+ return null;
+ }, [messages]);
+
+ const isStreaming = useMemo(
+ () => isRunning && !!lastAssistantMessage,
+ [isRunning, lastAssistantMessage],
+ );
+
+ const openuiCode = useMemo(
+ () => (lastAssistantMessage?.content as string) ?? null,
+ [lastAssistantMessage],
+ );
+
+ const previewRef = useAutoScroll([lastAssistantMessage?.content], isRunning);
+ const { renderedHtml, htmlLoading, emailSubject, handleParseResult } = useEmailRendering(
+ openuiCode,
+ isStreaming,
+ isRunning,
+ );
+ const htmlClipboard = useClipboard();
+ const subjectClipboard = useClipboard();
+
+ const handleSubmit = (e: React.FormEvent) => {
+ e.preventDefault();
+ if (!input.trim() || isRunning) return;
+ processMessage({ role: "user", content: input.trim() });
+ setInput("");
+ };
+
+ const hasContent = !!openuiCode || !!lastAssistantMessage;
+
+ return (
+ <div
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ height: "100%",
+ backgroundColor: isDark ? "#050505" : "#f5f5f5",
+ }}
+ >
+ <TopBar isDark={isDark} isMobile={isMobile} isRunning={isRunning} onNewEmail={onNewEmail} />
+
+ {isMobile && hasContent && (
+ <MobileTabToggle isDark={isDark} mobileTab={mobileTab} onTabChange={setMobileTab} />
+ )}
+
+ {/* Content area */}
+ <div style={{ flex: 1, overflow: "hidden", display: "flex" }}>
+ {hasContent && (!isMobile || mobileTab === "html") && (
+ <HtmlPanel
+ isDark={isDark}
+ isMobile={isMobile}
+ isStreaming={isStreaming}
+ renderedHtml={renderedHtml}
+ htmlLoading={htmlLoading}
+ copied={htmlClipboard.copied}
+ onCopy={() => renderedHtml && htmlClipboard.copy(renderedHtml)}
+ />
+ )}
+
+ {(!isMobile || mobileTab === "preview" || !hasContent) && (
+ <PreviewPanel
+ isDark={isDark}
+ isMobile={isMobile}
+ hasContent={hasContent}
+ openuiCode={openuiCode}
+ isStreaming={isStreaming}
+ isRunning={isRunning}
+ emailSubject={emailSubject}
+ copiedSubject={subjectClipboard.copied}
+ onCopySubject={() => emailSubject && subjectClipboard.copy(emailSubject)}
+ onParseResult={handleParseResult}
+ scrollRef={previewRef}
+ />
+ )}
+ </div>
+
+ <MessageInput
+ isDark={isDark}
+ isMobile={isMobile}
+ isRunning={isRunning}
+ input={input}
+ onInputChange={setInput}
+ onSubmit={handleSubmit}
+ />
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/emailEditor/messageInput.tsx b/examples/react-email/src/components/emailEditor/messageInput.tsx
new file mode 100644
index 000000000..6fb8b3b1c
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/messageInput.tsx
@@ -0,0 +1,156 @@
+"use client";
+
+import { Send as SendIcon } from "lucide-react";
+
+interface MessageInputProps {
+ isDark: boolean;
+ isMobile: boolean;
+ isRunning: boolean;
+ input: string;
+ onInputChange: (value: string) => void;
+ onSubmit: (e: React.FormEvent) => void;
+}
+
+export function MessageInput({
+ isDark,
+ isMobile,
+ isRunning,
+ input,
+ onInputChange,
+ onSubmit,
+}: MessageInputProps) {
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ onSubmit(e);
+ }
+ };
+
+ const hasInput = input.trim().length > 0;
+
+ return (
+ <div
+ style={{
+ flexShrink: 0,
+ padding: isMobile ? "8px 12px" : "16px 24px",
+ backgroundColor: isDark ? "#0a0a0a" : "#ffffff",
+ borderTop: `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ }}
+ >
+ <form onSubmit={onSubmit} style={{ margin: "0 auto", maxWidth: isMobile ? "100%" : "800px" }}>
+ <div
+ style={{
+ borderRadius: isMobile ? "10px" : "14px",
+ border: `1px solid ${isDark ? "#1f1f1f" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#111111" : "#f9fafb",
+ overflow: "hidden",
+ transition: "border-color 0.2s, box-shadow 0.2s",
+ opacity: isRunning ? 0.5 : 1,
+ display: isMobile ? "flex" : undefined,
+ alignItems: isMobile ? "center" : undefined,
+ }}
+ >
+ {isMobile ? (
+ <input
+ value={input}
+ onChange={(e) => onInputChange(e.target.value)}
+ placeholder="Ask for changes..."
+ disabled={isRunning}
+ style={{
+ flex: 1,
+ padding: "12px 14px",
+ fontSize: "14px",
+ border: "none",
+ backgroundColor: "transparent",
+ color: isDark ? "#f5f5f5" : "#111827",
+ outline: "none",
+ boxSizing: "border-box",
+ fontFamily: "inherit",
+ }}
+ onFocus={(e) => {
+ if (!isRunning) {
+ const container = e.currentTarget.parentElement;
+ if (container) container.style.borderColor = "#5F51E8";
+ }
+ }}
+ onBlur={(e) => {
+ const container = e.currentTarget.parentElement;
+ if (container) container.style.borderColor = isDark ? "#1f1f1f" : "#e5e7eb";
+ }}
+ />
+ ) : (
+ <textarea
+ value={input}
+ onChange={(e) => onInputChange(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder="Describe what you'd like to change..."
+ disabled={isRunning}
+ rows={3}
+ style={{
+ width: "100%",
+ padding: "16px 16px 40px 16px",
+ fontSize: "14px",
+ lineHeight: "1.6",
+ border: "none",
+ backgroundColor: "transparent",
+ color: isDark ? "#f5f5f5" : "#111827",
+ outline: "none",
+ boxSizing: "border-box",
+ resize: "none",
+ fontFamily: "inherit",
+ }}
+ onFocus={(e) => {
+ if (!isRunning) {
+ const container = e.currentTarget.parentElement;
+ if (container) {
+ container.style.borderColor = "#5F51E8";
+ container.style.boxShadow = isDark
+ ? "0 0 0 1px #5F51E8"
+ : "0 0 0 3px rgba(95, 81, 232, 0.1)";
+ }
+ }
+ }}
+ onBlur={(e) => {
+ const container = e.currentTarget.parentElement;
+ if (container) {
+ container.style.borderColor = isDark ? "#1f1f1f" : "#e5e7eb";
+ container.style.boxShadow = "none";
+ }
+ }}
+ />
+ )}
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "flex-end",
+ padding: isMobile ? "0 6px 0 0" : "0 10px 10px 10px",
+ }}
+ >
+ <button
+ type="submit"
+ disabled={isRunning}
+ style={{
+ width: isMobile ? "32px" : "36px",
+ height: isMobile ? "32px" : "36px",
+ borderRadius: "50%",
+ border: "none",
+ backgroundColor:
+ hasInput && !isRunning ? "#5F51E8" : isDark ? "#1a1a1a" : "#e5e7eb",
+ cursor: hasInput && !isRunning ? "pointer" : "default",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ transition: "background-color 0.2s",
+ }}
+ >
+ <SendIcon
+ size={16}
+ color={hasInput && !isRunning ? "#ffffff" : isDark ? "#4B5563" : "#9CA3AF"}
+ />
+ </button>
+ </div>
+ </div>
+ </form>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/emailEditor/mobileTabToggle.tsx b/examples/react-email/src/components/emailEditor/mobileTabToggle.tsx
new file mode 100644
index 000000000..362a5b53d
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/mobileTabToggle.tsx
@@ -0,0 +1,51 @@
+"use client";
+
+interface MobileTabToggleProps {
+ isDark: boolean;
+ mobileTab: "html" | "preview";
+ onTabChange: (tab: "html" | "preview") => void;
+}
+
+export function MobileTabToggle({ isDark, mobileTab, onTabChange }: MobileTabToggleProps) {
+ return (
+ <div
+ style={{
+ display: "flex",
+ padding: "8px 16px",
+ gap: "4px",
+ borderBottom: `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#0a0a0a" : "#ffffff",
+ flexShrink: 0,
+ }}
+ >
+ {(["html", "preview"] as const).map((tab) => (
+ <button
+ key={tab}
+ onClick={() => onTabChange(tab)}
+ style={{
+ flex: 1,
+ padding: "8px",
+ fontSize: "13px",
+ fontWeight: 600,
+ borderRadius: "8px",
+ border: "none",
+ cursor: "pointer",
+ backgroundColor:
+ mobileTab === tab ? (isDark ? "#1a1a2e" : "#EEF2FF") : "transparent",
+ color:
+ mobileTab === tab
+ ? isDark
+ ? "#818cf8"
+ : "#5F51E8"
+ : isDark
+ ? "#6B7280"
+ : "#9CA3AF",
+ transition: "all 0.15s",
+ }}
+ >
+ {tab.toUpperCase()}
+ </button>
+ ))}
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/emailEditor/previewPanel.tsx b/examples/react-email/src/components/emailEditor/previewPanel.tsx
new file mode 100644
index 000000000..022fd69df
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/previewPanel.tsx
@@ -0,0 +1,159 @@
+"use client";
+
+import { emailLibrary } from "@openuidev/react-email";
+import type { ParseResult } from "@openuidev/react-lang";
+import { Renderer } from "@openuidev/react-lang";
+import { Check as CheckIcon, Copy as CopyIcon, Mail as MailIcon } from "lucide-react";
+import type { RefObject } from "react";
+import { LoadingDots } from "../loadingDots";
+
+interface PreviewPanelProps {
+ isDark: boolean;
+ isMobile: boolean;
+ hasContent: boolean;
+ openuiCode: string | null;
+ isStreaming: boolean;
+ isRunning: boolean;
+ emailSubject: string | null;
+ copiedSubject: boolean;
+ onCopySubject: () => void;
+ onParseResult: (result: ParseResult | null) => void;
+ scrollRef: RefObject<HTMLDivElement | null>;
+}
+
+export function PreviewPanel({
+ isDark,
+ isMobile,
+ hasContent,
+ openuiCode,
+ isStreaming,
+ isRunning,
+ emailSubject,
+ copiedSubject,
+ onCopySubject,
+ onParseResult,
+ scrollRef,
+}: PreviewPanelProps) {
+ return (
+ <div
+ ref={scrollRef}
+ style={{
+ flex: 1,
+ minWidth: 0,
+ overflow: "auto",
+ display: "flex",
+ flexDirection: "column",
+ }}
+ >
+ {/* Header (desktop only) */}
+ {hasContent && !isMobile && (
+ <div
+ style={{
+ padding: "12px 20px",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ flexShrink: 0,
+ borderBottom: `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#050505" : "#f5f5f5",
+ position: "sticky",
+ top: 0,
+ zIndex: 1,
+ }}
+ >
+ <span
+ style={{
+ fontSize: "12px",
+ fontWeight: 600,
+ color: isDark ? "#6B7280" : "#9CA3AF",
+ textTransform: "uppercase",
+ letterSpacing: "0.05em",
+ }}
+ >
+ Preview
+ </span>
+ {emailSubject && (
+ <button
+ onClick={onCopySubject}
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: "5px",
+ padding: "5px 12px",
+ fontSize: "12px",
+ fontWeight: 500,
+ borderRadius: "8px",
+ border: "none",
+ backgroundColor: copiedSubject ? "#16a34a" : isDark ? "#1f1f1f" : "#f3f4f6",
+ color: copiedSubject ? "#ffffff" : isDark ? "#e5e7eb" : "#374151",
+ cursor: "pointer",
+ transition: "all 0.2s",
+ }}
+ >
+ {copiedSubject ? (
+ <CheckIcon size={12} color="#ffffff" />
+ ) : (
+ <CopyIcon size={12} color={isDark ? "#e5e7eb" : "#374151"} />
+ )}
+ {copiedSubject ? "Copied!" : "Copy Subject"}
+ </button>
+ )}
+ </div>
+ )}
+
+ {/* Content */}
+ <div style={{ flex: 1, padding: hasContent ? "16px 20px" : "32px 24px" }}>
+ {openuiCode ? (
+ <Renderer
+ response={openuiCode}
+ library={emailLibrary}
+ isStreaming={isStreaming}
+ onParseResult={onParseResult}
+ />
+ ) : isRunning ? (
+ <LoadingState isDark={isDark} />
+ ) : null}
+ </div>
+ </div>
+ );
+}
+
+function LoadingState({ isDark }: { isDark: boolean }) {
+ return (
+ <div
+ style={{
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ height: "100%",
+ minHeight: "300px",
+ gap: "20px",
+ }}
+ >
+ <div
+ style={{
+ width: 56,
+ height: 56,
+ borderRadius: "16px",
+ backgroundColor: isDark ? "#1a1a2e" : "#EEF2FF",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <MailIcon size={28} color={isDark ? "#818cf8" : "#5F51E8"} />
+ </div>
+ <LoadingDots color={isDark ? "#818cf8" : "#5F51E8"} />
+ <span
+ style={{
+ fontSize: "14px",
+ fontWeight: 500,
+ color: isDark ? "#6B7280" : "#9CA3AF",
+ }}
+ >
+ Crafting your email...
+ </span>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/emailEditor/topBar.tsx b/examples/react-email/src/components/emailEditor/topBar.tsx
new file mode 100644
index 000000000..57ad6bd92
--- /dev/null
+++ b/examples/react-email/src/components/emailEditor/topBar.tsx
@@ -0,0 +1,151 @@
+"use client";
+
+import { Mail as MailIcon, Plus as PlusIcon } from "lucide-react";
+
+interface TopBarProps {
+ isDark: boolean;
+ isMobile: boolean;
+ isRunning: boolean;
+ onNewEmail: () => void;
+}
+
+export function TopBar({ isDark, isMobile, isRunning, onNewEmail }: TopBarProps) {
+ return (
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ padding: "14px 24px",
+ backgroundColor: isDark ? "#0a0a0a" : "#ffffff",
+ borderBottom: `1px solid ${isDark ? "#1a1a1a" : "#e5e7eb"}`,
+ flexShrink: 0,
+ }}
+ >
+ <div style={{ display: "flex", alignItems: "center", gap: "10px" }}>
+ <div
+ style={{
+ width: 28,
+ height: 28,
+ borderRadius: "8px",
+ backgroundColor: isDark ? "#1a1a2e" : "#EEF2FF",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <MailIcon size={16} color={isDark ? "#818cf8" : "#5F51E8"} />
+ </div>
+ <span
+ style={{
+ fontSize: "15px",
+ fontWeight: 600,
+ color: isDark ? "#f5f5f5" : "#111827",
+ }}
+ >
+ Email Generator
+ </span>
+ {isRunning && <GeneratingIndicator isDark={isDark} isMobile={isMobile} />}
+ </div>
+
+ <button
+ onClick={onNewEmail}
+ title="New Email"
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: isMobile ? 0 : "6px",
+ padding: isMobile ? "8px" : "8px 16px",
+ borderRadius: isMobile ? "8px" : "10px",
+ border: `1px solid ${isDark ? "#1f1f1f" : "#e5e7eb"}`,
+ backgroundColor: isDark ? "#111111" : "#ffffff",
+ color: isDark ? "#e5e7eb" : "#374151",
+ fontSize: "13px",
+ fontWeight: 500,
+ cursor: "pointer",
+ transition: "all 0.2s",
+ width: isMobile ? "36px" : undefined,
+ height: isMobile ? "36px" : undefined,
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.borderColor = "#5F51E8";
+ e.currentTarget.style.backgroundColor = isDark ? "#1a1a2e" : "#EEF2FF";
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.borderColor = isDark ? "#1f1f1f" : "#e5e7eb";
+ e.currentTarget.style.backgroundColor = isDark ? "#111111" : "#ffffff";
+ }}
+ >
+ <PlusIcon size={isMobile ? 16 : 14} color={isDark ? "#e5e7eb" : "#374151"} />
+ {!isMobile && "New Email"}
+ </button>
+ </div>
+ );
+}
+
+function GeneratingIndicator({ isDark, isMobile }: { isDark: boolean; isMobile: boolean }) {
+ if (isMobile) {
+ return (
+ <>
+ <style>{`
+ @keyframes email-spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+ `}</style>
+ <div
+ style={{
+ width: 18,
+ height: 18,
+ borderRadius: "50%",
+ border: "2px solid transparent",
+ borderTopColor: "#5F51E8",
+ borderRightColor: "#5F51E8",
+ animation: "email-spin 0.8s linear infinite",
+ marginLeft: "6px",
+ }}
+ />
+ </>
+ );
+ }
+
+ return (
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: "6px",
+ padding: "4px 12px",
+ borderRadius: "16px",
+ backgroundColor: isDark ? "#1a1a2e" : "#EEF2FF",
+ marginLeft: "4px",
+ }}
+ >
+ <style>{`
+ @keyframes email-pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.3; }
+ }
+ `}</style>
+ <div
+ style={{
+ width: 6,
+ height: 6,
+ borderRadius: "50%",
+ backgroundColor: "#5F51E8",
+ animation: "email-pulse 1.5s ease-in-out infinite",
+ }}
+ />
+ <span
+ style={{
+ fontSize: "12px",
+ fontWeight: 500,
+ color: isDark ? "#818cf8" : "#5F51E8",
+ }}
+ >
+ Generating...
+ </span>
+ </div>
+ );
+}
diff --git a/examples/react-email/src/components/loadingDots.tsx b/examples/react-email/src/components/loadingDots.tsx
new file mode 100644
index 000000000..ab5960d79
--- /dev/null
+++ b/examples/react-email/src/components/loadingDots.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+export function LoadingDots({ color }: { color: string }) {
+ return (
+ <>
+ <style>{`
+ @keyframes email-bounce {
+ 0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
+ 40% { transform: scale(1); opacity: 1; }
+ }
+ `}</style>
+ <div style={{ display: "flex", alignItems: "center", gap: "6px" }}>
+ {[0, 1, 2].map((i) => (
+ <div
+ key={i}
+ style={{
+ width: 8,
+ height: 8,
+ borderRadius: "50%",
+ backgroundColor: color,
+ animation: `email-bounce 1.4s ease-in-out ${i * 0.16}s infinite both`,
+ }}
+ />
+ ))}
+ </div>
+ </>
+ );
+}
diff --git a/examples/react-email/src/components/session.ts b/examples/react-email/src/components/session.ts
new file mode 100644
index 000000000..826de3abe
--- /dev/null
+++ b/examples/react-email/src/components/session.ts
@@ -0,0 +1,40 @@
+const VIEW_KEY = "email-chat-view";
+const MESSAGES_KEY = "email-chat-messages";
+
+export function saveView(view: "compose" | "chat") {
+ try {
+ sessionStorage.setItem(VIEW_KEY, view);
+ } catch { /* ignore */ }
+}
+
+export function loadView(): "compose" | "chat" {
+ try {
+ const v = sessionStorage.getItem(VIEW_KEY);
+ if (v === "chat") return "chat";
+ } catch { /* ignore */ }
+ return "compose";
+}
+
+export function saveMessages(messages: unknown[]) {
+ try {
+ sessionStorage.setItem(MESSAGES_KEY, JSON.stringify(messages));
+ } catch { /* ignore */ }
+}
+
+export function loadMessages(): unknown[] | null {
+ try {
+ const raw = sessionStorage.getItem(MESSAGES_KEY);
+ if (raw) {
+ const parsed = JSON.parse(raw);
+ if (Array.isArray(parsed) && parsed.length > 0) return parsed;
+ }
+ } catch { /* ignore */ }
+ return null;
+}
+
+export function clearSession() {
+ try {
+ sessionStorage.removeItem(VIEW_KEY);
+ sessionStorage.removeItem(MESSAGES_KEY);
+ } catch { /* ignore */ }
+}
diff --git a/examples/react-email/src/generated/system-prompt.txt b/examples/react-email/src/generated/system-prompt.txt
new file mode 100644
index 000000000..01539c412
--- /dev/null
+++ b/examples/react-email/src/generated/system-prompt.txt
@@ -0,0 +1,378 @@
+You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code — no markdown, no explanations, just openui-lang.
+
+## Syntax Rules
+
+1. Each statement is on its own line: `identifier = Expression`
+2. `root` is the entry point — every program must define `root = EmailTemplate(...)`
+3. Expressions are: strings ("..."), numbers, booleans (true/false), arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)
+4. Use references for readability: define `name = ...` on one line, then use `name` later
+5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.
+6. Arguments are POSITIONAL (order matters, not names)
+7. Optional arguments can be omitted from the end
+8. No operators, no logic, no variables — only declarations
+9. Strings use double quotes with backslash escaping
+
+## Component Signatures
+
+Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.
+The `action` prop type accepts: ContinueConversation (sends message to LLM), OpenUrl (navigates to URL), or Custom (app-defined).
+
+### Email Structure
+EmailTemplate(subject: string, previewText?: string, children: (EmailHeading | EmailText | EmailButton | EmailImage | EmailDivider | EmailLink | EmailCodeBlock | EmailCodeInline | EmailMarkdown | EmailArticle | EmailProductCard | EmailFeatureGrid | EmailFeatureList | EmailNumberedSteps | EmailCheckoutTable | EmailPricingCard | EmailTestimonial | EmailSurveyRating | EmailStats | EmailImageGrid | EmailAvatarGroup | EmailAvatarWithText | EmailList | EmailCustomerReview | EmailBentoGrid | EmailSection | EmailColumns | EmailColumn | EmailHeaderSideNav | EmailHeaderCenteredNav | EmailHeaderSocial | EmailFooterCentered | EmailFooterTwoColumn)[]) — Root email template. Renders a live email preview with Copy HTML export. Always provide a subject line.
+EmailSection(children: (EmailHeading | EmailText | EmailButton | EmailImage | EmailDivider | EmailLink | EmailCodeBlock | EmailCodeInline | EmailMarkdown | EmailArticle | EmailProductCard | EmailFeatureGrid | EmailFeatureList | EmailNumberedSteps | EmailCheckoutTable | EmailPricingCard | EmailTestimonial | EmailSurveyRating | EmailStats | EmailImageGrid | EmailAvatarGroup | EmailAvatarWithText | EmailList | EmailCustomerReview | EmailBentoGrid)[]) — Groups email content into a section. Use to organize header, body, and footer areas.
+EmailColumns(children: EmailColumn[]) — Multi-column row layout. Contains EmailColumn children.
+EmailColumn(children: (EmailHeading | EmailText | EmailButton | EmailImage | EmailDivider | EmailLink | EmailCodeBlock | EmailCodeInline | EmailMarkdown | EmailArticle | EmailProductCard | EmailFeatureGrid | EmailFeatureList | EmailNumberedSteps | EmailCheckoutTable | EmailPricingCard | EmailTestimonial | EmailSurveyRating | EmailStats | EmailImageGrid | EmailAvatarGroup | EmailAvatarWithText | EmailList | EmailCustomerReview | EmailBentoGrid)[]) — A single column within an EmailColumns row.
+- EmailTemplate is the root email wrapper. Always use it for email content.
+- Use EmailSection to group related content (e.g. header area, body, footer).
+- Use EmailColumns + EmailColumn for multi-column layouts (e.g. two features side by side).
+
+### Email Headers
+EmailHeaderSideNav(logoSrc: string, logoAlt: string, logoHeight?: number, links: EmailNavLink[]) — Header with logo on the left and navigation links on the right. Uses EmailNavLink items.
+EmailHeaderCenteredNav(logoSrc: string, logoAlt: string, logoHeight?: number, links: EmailNavLink[]) — Header with logo centered on top and navigation links centered below. Uses EmailNavLink items.
+EmailHeaderSocial(logoSrc: string, logoAlt: string, logoHeight?: number, icons: EmailSocialIcon[]) — Header with logo on the left and social media icon links on the right. Uses EmailSocialIcon items.
+EmailNavLink(text: string, href: string) — Navigation link item for email headers.
+EmailSocialIcon(src: string, alt: string, href: string) — Social media icon link for email headers. src should be a square icon image URL.
+- EmailHeaderSideNav: Logo on the left, text navigation links on the right. Use EmailNavLink for each link.
+- EmailHeaderCenteredNav: Logo centered on top, text navigation links centered below. Use EmailNavLink for each link.
+- EmailHeaderSocial: Logo on the left, social media icon links on the right. Use EmailSocialIcon for each icon.
+- Place a header as the FIRST child of EmailTemplate for a professional branded look.
+- Always follow the header with an EmailDivider to separate it from the body content.
+
+### Email Footers
+EmailFooterCentered(logoSrc: string, logoAlt: string, companyName: string, tagline?: string, address: string, contact?: string, icons?: EmailSocialIcon[]) — Centered footer with logo, company name, tagline, social icons, address, and contact info. Uses EmailSocialIcon items.
+EmailFooterTwoColumn(logoSrc: string, logoAlt: string, companyName: string, tagline?: string, address: string, contact?: string, icons?: EmailSocialIcon[]) — Two-column footer with logo and company info on the left, social icons and address on the right. Uses EmailSocialIcon items.
+- EmailFooterCentered: Centered footer with logo, company name, tagline, social icons, address, and contact info.
+- EmailFooterTwoColumn: Two-column footer with logo and company info on the left, social icons and address on the right.
+- Both footer components accept EmailSocialIcon items for social media icons.
+- Place a footer as the LAST child of EmailTemplate, after an EmailDivider.
+
+### Email Content
+EmailHeading(text: string, level?: number) — Email heading (h1-h6). Use level 1 for main title, 2 for section headers.
+EmailText(text: string) — Email text paragraph for body content.
+EmailButton(label: string, href: string, backgroundColor?: string) — Email call-to-action button with link.
+EmailImage(src: string, alt: string, width?: number) — Email image. Use real, publicly accessible URLs.
+EmailDivider() — Horizontal divider line to separate email sections.
+EmailLink(text: string, href: string) — Inline hyperlink in email content.
+EmailCodeBlock(code: string, language?: string) — Syntax-highlighted code block for displaying code snippets in emails.
+EmailCodeInline(code: string) — Inline code snippet for embedding code within text.
+EmailMarkdown(content: string) — Renders markdown content as styled email HTML. Supports headings, bold, italic, links, lists, and code.
+- EmailHeading level 1 for main title, level 2 for section headers.
+- EmailButton always needs an href URL.
+- EmailImage should use real, publicly accessible image URLs.
+- EmailDivider takes no arguments: EmailDivider()
+- EmailCodeBlock for multi-line code snippets. Optionally set language (e.g. 'javascript', 'python').
+- EmailCodeInline for inline code within text (e.g. variable names, commands).
+- EmailMarkdown for rendering markdown content (headings, bold, italic, links, lists).
+
+### Email Articles & Products
+EmailArticle(imageSrc: string, imageAlt: string, category?: string, title: string, description: string, buttonLabel: string, buttonHref: string, buttonColor?: string) — Article block with hero image, optional category label, title, description, and CTA button. Great for blog posts and newsletter articles.
+EmailProductCard(imageSrc: string, imageAlt: string, category?: string, title: string, description: string, price: string, buttonLabel: string, buttonHref: string, buttonColor?: string) — Product showcase card with hero image, optional category, title, description, price, and buy button.
+- EmailArticle: Hero image + category + title + description + CTA button. Great for blog posts and newsletters.
+- EmailProductCard: Hero image + category + title + description + price + buy button. Great for product showcases.
+- Both support an optional buttonColor prop for CTA button customization.
+
+### Email Features & Steps
+EmailFeatureItem(iconSrc: string, iconAlt: string, title: string, description: string) — Single feature item with icon, title, and description. Used inside EmailFeatureGrid or EmailFeatureList.
+EmailFeatureGrid(title: string, description: string, items: EmailFeatureItem[]) — 2x2 feature grid with header title, description, and four feature items each with icon, title, and description.
+EmailFeatureList(title: string, description: string, items: EmailFeatureItem[]) — Vertical feature list with header title, description, and feature items separated by dividers. Each item has an icon, title, and description.
+EmailStepItem(title: string, description: string) — Single numbered step with title and description. Used inside EmailNumberedSteps.
+EmailNumberedSteps(title: string, description: string, steps: EmailStepItem[]) — Numbered steps list with header title, description, and sequential step items. Each step shows a numbered badge, title, and description.
+- EmailFeatureItem: Child component with iconSrc, iconAlt, title, description. Used inside EmailFeatureGrid or EmailFeatureList.
+- EmailFeatureGrid: 2x2 grid of features with header title and description. Takes EmailFeatureItem items.
+- EmailFeatureList: Vertical list of features separated by dividers. Takes EmailFeatureItem items.
+- EmailStepItem: Child component with title and description. Used inside EmailNumberedSteps.
+- EmailNumberedSteps: Numbered steps list with auto-numbered badges. Takes EmailStepItem items.
+- For icon URLs, use https://picsum.photos/seed/KEYWORD/48/48 or similar.
+
+### Email Commerce
+EmailCheckoutItem(imageSrc?: string, imageAlt?: string, name: string, quantity?: number, price: string) — Single checkout/cart item with optional image, name, quantity, and price. Used inside EmailCheckoutTable.
+EmailCheckoutTable(title?: string, items: EmailCheckoutItem[], buttonLabel: string, buttonHref: string, buttonColor?: string) — Checkout/cart table with product items (image, name, quantity, price) and a checkout button. Great for abandoned cart and order summary emails.
+EmailPricingFeature(text: string) — Single pricing feature line item. Used inside EmailPricingCard.
+EmailPricingCard(badge?: string, price: string, period?: string, description: string, features: EmailPricingFeature[], buttonLabel: string, buttonHref: string, buttonColor?: string, note?: string, subNote?: string) — Pricing card with badge, price, description, feature list, CTA button, and optional note. Great for upgrade and promotional emails.
+- EmailCheckoutItem: Cart item with optional image, name, quantity, price. Used inside EmailCheckoutTable.
+- EmailCheckoutTable: Cart table with items and checkout button. Great for abandoned cart and order summary emails.
+- EmailPricingFeature: Single feature line item text. Used inside EmailPricingCard.
+- EmailPricingCard: Pricing card with badge, price, period, description, features list, CTA button, and optional note.
+
+### Email Social Proof & Surveys
+EmailTestimonial(quote: string, avatarSrc: string, avatarAlt: string, name: string, role: string) — Testimonial quote with avatar, name, and role. Centered layout for social proof in emails.
+EmailSurveyRating(question: string, description?: string, buttonColor?: string) — Rating survey section with a question and 1-5 numbered buttons. Great for feedback and NPS emails.
+EmailStatItem(value: string, label: string) — Single stat with a value and label. Used inside EmailStats.
+EmailStats(items: EmailStatItem[]) — Horizontal stats row displaying key metrics. Each stat has a large value and a label below it.
+- EmailTestimonial: Centered testimonial quote with avatar, name, and role.
+- EmailSurveyRating: Rating survey with question and 1-5 numbered buttons. Great for feedback/NPS emails.
+- EmailStatItem: Child component with value and label. Used inside EmailStats.
+- EmailStats: Horizontal row of key metrics/stats.
+
+### Email Image Layouts
+EmailImageGrid(title?: string, description?: string, images: EmailImage[]) — 2x2 image grid layout with optional header title and description. Pass up to 4 EmailImage items. Great for product galleries and portfolios.
+- EmailImageGrid: 2x2 image grid with optional title and description. Pass up to 4 EmailImage items.
+- Great for product galleries, portfolios, and visual showcases.
+
+### Email Avatars
+EmailAvatar(src: string, alt: string, size?: number, rounded?: "full" | "md") — Avatar image component. Supports circular (rounded='full') or rounded-square (rounded='md') shapes, and configurable size.
+EmailAvatarGroup(avatars: EmailAvatar[]) — Overlapping stacked avatar group. Pass EmailAvatar items to display them in a horizontal row with negative offset overlap.
+EmailAvatarWithText(avatarSrc: string, avatarAlt: string, name: string, role: string, href?: string) — Avatar with name and role text beside it. Optionally wraps in a link. Great for author attribution or team member display.
+- EmailAvatar: Single avatar image. Supports circular (rounded='full') or rounded-square (rounded='md') shapes, and configurable size.
+- EmailAvatarGroup: Overlapping stacked avatars. Pass EmailAvatar items. Great for showing team members or participants.
+- EmailAvatarWithText: Avatar with name and role text beside it. Optionally wraps in a link. Great for author attribution.
+
+### Email Lists
+EmailListItem(title: string, description: string) — Data-only list item with title and description. Used as a child inside EmailList.
+EmailList(title?: string, items: EmailListItem[]) — Numbered list with circular number badges and item title + description. Pass EmailListItem children. Great for feature lists, how-it-works sections, and top-N lists.
+- EmailListItem: Data-only component with title and description. Used as a child inside EmailList.
+- EmailList: Numbered list with circular badges. Pass EmailListItem children. Great for top-N lists, how-it-works, and feature lists.
+
+### Email Reviews
+EmailCustomerReview(title?: string, totalReviews: number, rating5: number, rating4: number, rating3: number, rating2: number, rating1: number, buttonLabel?: string, buttonHref?: string, buttonColor?: string) — Customer review summary with star rating distribution bars showing percentages for each rating (1-5). Includes total review count and optional CTA button to write a review.
+- EmailCustomerReview: Star rating distribution with bars and percentages. Shows total review count and optional CTA button.
+- Provide rating counts for each star level (rating1 through rating5) and totalReviews.
+
+### Email Marketing
+EmailBentoItem(imageSrc: string, imageAlt: string, title: string, description: string) — Data-only bento grid item with image, title, and description. Used as a child inside EmailBentoGrid.
+EmailBentoGrid(heroTitle: string, heroDescription: string, heroLinkText?: string, heroLinkHref?: string, heroImageSrc: string, heroImageAlt: string, items: EmailBentoItem[]) — Bento grid layout with a dark hero section (title, description, link, image) on top and a row of product cards below. Pass EmailBentoItem children for the bottom row. Great for marketing and product showcase emails.
+- EmailBentoItem: Data-only component with imageSrc, imageAlt, title, description. Used inside EmailBentoGrid.
+- EmailBentoGrid: Bento-style layout with a dark hero section on top and product cards below. Pass EmailBentoItem children.
+- Great for product showcase and marketing emails.
+
+## Hoisting & Streaming (CRITICAL)
+
+openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
+
+During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
+
+**Recommended statement order for optimal streaming:**
+1. `root = EmailTemplate(...)` — UI shell appears immediately
+2. Component definitions — fill in as they stream
+3. Data values — leaf content last
+
+Always write the root = EmailTemplate(...) statement first so the UI shell appears immediately, even before child data has streamed in.
+
+## Examples
+
+Example 1 — Welcome email:
+root = EmailTemplate("Welcome to Acme!", "You're in! Here's how to get started.", [heading, intro, btn, divider, footer])
+heading = EmailHeading("Welcome aboard!", 1)
+intro = EmailText("Thanks for signing up for Acme. We're thrilled to have you on board. Here's everything you need to get started.")
+btn = EmailButton("Get Started", "https://example.com/start", "#5F51E8")
+divider = EmailDivider()
+footer = EmailText("If you have any questions, reply to this email. We're here to help.")
+
+Example 2 — Newsletter with header and footer:
+root = EmailTemplate("Acme Weekly", "This week: new features and tips", [header, divider1, section1, divider2, section2, divider3, footer])
+header = EmailHeaderSideNav("https://picsum.photos/seed/acme-logo/150/42", "Acme", 42, [nav1, nav2, nav3])
+nav1 = EmailNavLink("About", "https://example.com/about")
+nav2 = EmailNavLink("Blog", "https://example.com/blog")
+nav3 = EmailNavLink("Docs", "https://example.com/docs")
+divider1 = EmailDivider()
+section1 = EmailSection([s1title, s1text, s1btn])
+s1title = EmailHeading("New Feature: Dark Mode", 2)
+s1text = EmailText("We just launched dark mode across all platforms. Your eyes will thank you.")
+s1btn = EmailButton("Try It Now", "https://example.com/dark-mode", "#1a1a2e")
+divider2 = EmailDivider()
+section2 = EmailSection([s2title, s2text])
+s2title = EmailHeading("Tip of the Week", 2)
+s2text = EmailText("Use keyboard shortcuts to navigate 3x faster.")
+divider3 = EmailDivider()
+footer = EmailFooterCentered("https://picsum.photos/seed/acme-icon/42/42", "Acme", "Acme Corporation", "Think different", "123 Main Street, Anytown, CA 12345", "[email protected]", [fi1, fi2, fi3])
+fi1 = EmailSocialIcon("https://react.email/static/facebook-logo.png", "Facebook", "https://facebook.com/acme")
+fi2 = EmailSocialIcon("https://react.email/static/x-logo.png", "X", "https://x.com/acme")
+fi3 = EmailSocialIcon("https://react.email/static/instagram-logo.png", "Instagram", "https://instagram.com/acme")
+
+Example 3 — Order confirmation with columns:
+root = EmailTemplate("Order Confirmed #12345", "Your order has been placed!", [heading, thanks, divider1, cols, divider2, total, btn, divider3, footer])
+heading = EmailHeading("Order Confirmed", 1)
+thanks = EmailText("Thank you for your purchase! Here's a summary of your order.")
+divider1 = EmailDivider()
+cols = EmailColumns([col1, col2])
+col1 = EmailColumn([itemTitle, itemDesc])
+col2 = EmailColumn([priceTitle, priceVal])
+itemTitle = EmailHeading("Item", 2)
+itemDesc = EmailText("Premium Plan - Annual")
+priceTitle = EmailHeading("Price", 2)
+priceVal = EmailText("$99.00/year")
+divider2 = EmailDivider()
+total = EmailText("Total: $99.00")
+btn = EmailButton("View Order", "https://example.com/orders/12345", "#16a34a")
+divider3 = EmailDivider()
+footer = EmailText("Need help? Contact us at [email protected]")
+
+Example 4 — Developer onboarding with code:
+root = EmailTemplate("Getting Started with Acme API", "Your API key is ready", [heading, intro, section1, divider, section2, divider2, footer])
+heading = EmailHeading("Welcome to the Acme API", 1)
+intro = EmailMarkdown("You're all set! Below you'll find everything you need to **get started** with our API.")
+section1 = EmailSection([s1title, s1text, codeblock])
+s1title = EmailHeading("Quick Start", 2)
+s1text = EmailText("Install the SDK and make your first request:")
+codeblock = EmailCodeBlock("npm install @acme/sdk\n\nimport { Acme } from '@acme/sdk';\nconst client = new Acme({ apiKey: 'your-key' });\nconst res = await client.ping();", "javascript")
+divider = EmailDivider()
+section2 = EmailSection([s2title, s2text])
+s2title = EmailHeading("Need Help?", 2)
+s2text = EmailMarkdown("Check our [documentation](https://docs.example.com) or reply to this email.")
+divider2 = EmailDivider()
+footer = EmailText("Happy coding!")
+
+Example 5 — Password reset email:
+root = EmailTemplate("Reset your password", "Someone requested a password change", [logo, heading, text1, btn, text2, divider, linkText, divider2, footer])
+logo = EmailImage("https://picsum.photos/seed/app-logo/100/30", "App", 100)
+heading = EmailHeading("Reset your password", 1)
+text1 = EmailText("Someone recently requested a password change for your account. If this was you, click below:")
+btn = EmailButton("Reset Password", "https://example.com/reset?token=abc123", "#0061fe")
+text2 = EmailText("Or copy and paste this link:")
+divider = EmailDivider()
+linkText = EmailLink("https://example.com/reset?token=abc123", "https://example.com/reset?token=abc123")
+divider2 = EmailDivider()
+footer = EmailText("If you didn't request this, just ignore this email. This link expires in 24 hours.")
+
+Example 6 — Promotional sale email:
+root = EmailTemplate("Summer Sale — Up to 50% Off!", "Don't miss our biggest sale", [hero, heading, subhead, divider1, featCols, divider2, ctaBtn, divider3, footer])
+hero = EmailImage("https://picsum.photos/seed/summer-sale/600/250", "Summer Sale Banner", 600)
+heading = EmailHeading("Summer Sale is Here!", 1)
+subhead = EmailText("For a limited time, enjoy up to 50% off on select items.")
+divider1 = EmailDivider()
+featCols = EmailColumns([deal1Col, deal2Col, deal3Col])
+deal1Col = EmailColumn([deal1Img, deal1Name, deal1Price])
+deal2Col = EmailColumn([deal2Img, deal2Name, deal2Price])
+deal3Col = EmailColumn([deal3Img, deal3Name, deal3Price])
+deal1Img = EmailImage("https://picsum.photos/seed/product1/180/180", "Sunglasses", 180)
+deal1Name = EmailText("Designer Sunglasses")
+deal1Price = EmailText("$49.99 (was $99.99)")
+deal2Img = EmailImage("https://picsum.photos/seed/product2/180/180", "Beach Bag", 180)
+deal2Name = EmailText("Canvas Beach Bag")
+deal2Price = EmailText("$29.99 (was $59.99)")
+deal3Img = EmailImage("https://picsum.photos/seed/product3/180/180", "Sandals", 180)
+deal3Name = EmailText("Leather Sandals")
+deal3Price = EmailText("$39.99 (was $79.99)")
+divider2 = EmailDivider()
+ctaBtn = EmailButton("Shop the Sale", "https://example.com/summer-sale", "#e11d48")
+divider3 = EmailDivider()
+footer = EmailText("StyleShop · 500 Fashion Ave · New York, NY 10018")
+
+Example 7 — Feature showcase with grid and steps:
+root = EmailTemplate("Welcome to Acme!", "Discover what you can do", [heading, intro, divider1, featureGrid, divider2, steps, divider3, footer])
+heading = EmailHeading("Welcome to Acme!", 1)
+intro = EmailText("Here's what you can do with your new account:")
+divider1 = EmailDivider()
+featureGrid = EmailFeatureGrid("Key Features", "Powerful features to help you succeed.", [feat1, feat2, feat3, feat4])
+feat1 = EmailFeatureItem("https://picsum.photos/seed/heart/48/48", "Heart", "Easy to Use", "Get started in minutes.")
+feat2 = EmailFeatureItem("https://picsum.photos/seed/rocket/48/48", "Rocket", "Lightning Fast", "Blazing fast performance.")
+feat3 = EmailFeatureItem("https://picsum.photos/seed/shield/48/48", "Shield", "Secure", "Enterprise-grade security.")
+feat4 = EmailFeatureItem("https://picsum.photos/seed/chart/48/48", "Chart", "Analytics", "Deep data insights.")
+divider2 = EmailDivider()
+steps = EmailNumberedSteps("Getting Started", "Follow these steps:", [step1, step2, step3])
+step1 = EmailStepItem("Create Profile", "Set up your profile with a photo and bio.")
+step2 = EmailStepItem("Connect Tools", "Integrate with Slack, GitHub, and Jira.")
+step3 = EmailStepItem("Invite Team", "Add team members and start collaborating.")
+divider3 = EmailDivider()
+footer = EmailText("Acme, Inc. · San Francisco, CA 94107")
+
+Example 8 — Abandoned cart email:
+root = EmailTemplate("You left something behind!", "Complete your purchase", [heading, text, checkout, divider, footer])
+heading = EmailHeading("Don't forget your items!", 1)
+text = EmailText("Complete your purchase before these items sell out.")
+checkout = EmailCheckoutTable("Your Cart", [item1, item2], "Complete Purchase", "https://example.com/checkout", "#4F46E5")
+item1 = EmailCheckoutItem("https://picsum.photos/seed/watch/100/100", "Classic Watch", "Classic Watch", 1, "$210.00")
+item2 = EmailCheckoutItem("https://picsum.photos/seed/clock/100/100", "Wall Clock", "Analogue Clock", 2, "$40.00")
+divider = EmailDivider()
+footer = EmailText("Acme Store · 123 Commerce Way · San Francisco, CA 94107")
+
+Example 9 — Pricing with testimonial and survey:
+root = EmailTemplate("Upgrade to Pro", "Unlock premium features", [heading, text, divider1, pricing, divider2, testimonial, divider3, survey, divider4, footer])
+heading = EmailHeading("Upgrade Your Plan", 1)
+text = EmailText("You've been on the free plan for 30 days. Unlock everything with Pro.")
+divider1 = EmailDivider()
+pricing = EmailPricingCard("Pro", "$12", "/ month", "Everything you need to grow.", [pf1, pf2, pf3], "Upgrade Now", "https://example.com/upgrade", "#4F46E5")
+pf1 = EmailPricingFeature("Unlimited projects")
+pf2 = EmailPricingFeature("Advanced analytics")
+pf3 = EmailPricingFeature("Priority support")
+divider2 = EmailDivider()
+testimonial = EmailTestimonial("Acme Pro transformed our workflow. Can't imagine going back.", "https://picsum.photos/seed/ceo/100/100", "Jane Smith", "Jane Smith", "CEO, TechCorp")
+divider3 = EmailDivider()
+survey = EmailSurveyRating("How would you rate your experience?", "Your feedback helps us improve.", "#4F46E5")
+divider4 = EmailDivider()
+footer = EmailText("Acme, Inc. · San Francisco, CA 94107")
+
+Example 10 — Stats, gallery, avatars, list, and bento grid:
+root = EmailTemplate("Your Monthly Report", "Key metrics and highlights", [header, divider1, stats, divider2, gallery, divider3, team, divider4, list, divider5, bento, divider6, reviews, divider7, footer])
+header = EmailHeaderCenteredNav("https://picsum.photos/seed/acme/150/42", "Acme", 42, [nav1, nav2])
+nav1 = EmailNavLink("Dashboard", "https://example.com/dashboard")
+nav2 = EmailNavLink("Reports", "https://example.com/reports")
+divider1 = EmailDivider()
+stats = EmailStats([stat1, stat2, stat3])
+stat1 = EmailStatItem("12,847", "Users")
+stat2 = EmailStatItem("94.2%", "Uptime")
+stat3 = EmailStatItem("$48.5K", "Revenue")
+divider2 = EmailDivider()
+gallery = EmailImageGrid("New Products", "Our latest arrivals.", [img1, img2, img3, img4])
+img1 = EmailImage("https://picsum.photos/seed/prod-a/300/288", "Product A")
+img2 = EmailImage("https://picsum.photos/seed/prod-b/300/288", "Product B")
+img3 = EmailImage("https://picsum.photos/seed/prod-c/300/288", "Product C")
+img4 = EmailImage("https://picsum.photos/seed/prod-d/300/288", "Product D")
+divider3 = EmailDivider()
+team = EmailAvatarGroup([av1, av2, av3])
+av1 = EmailAvatar("https://picsum.photos/seed/person1/100/100", "Alice", 44)
+av2 = EmailAvatar("https://picsum.photos/seed/person2/100/100", "Bob", 44)
+av3 = EmailAvatar("https://picsum.photos/seed/person3/100/100", "Carol", 44)
+divider4 = EmailDivider()
+list = EmailList("Top 3 Updates", [li1, li2, li3])
+li1 = EmailListItem("New Dashboard", "Redesigned analytics dashboard with real-time data.")
+li2 = EmailListItem("Mobile App", "Now available on iOS and Android.")
+li3 = EmailListItem("API v2", "Faster, more reliable API with new endpoints.")
+divider5 = EmailDivider()
+bento = EmailBentoGrid("Featured Collection", "Handpicked products for you.", "Shop now", "https://example.com/shop", "https://picsum.photos/seed/hero/400/250", "Collection", [bi1, bi2])
+bi1 = EmailBentoItem("https://picsum.photos/seed/item-x/300/200", "Item X", "Premium Widget", "High-quality craftsmanship.")
+bi2 = EmailBentoItem("https://picsum.photos/seed/item-y/300/200", "Item Y", "Deluxe Gadget", "Next-gen technology.")
+divider6 = EmailDivider()
+reviews = EmailCustomerReview("Product Ratings", 500, 300, 100, 50, 30, 20, "Write a Review", "https://example.com/review", "#4F46E5")
+divider7 = EmailDivider()
+footer = EmailFooterTwoColumn("https://picsum.photos/seed/acme-icon/42/42", "Acme", "Acme Corp", "Innovation first", "123 Main St, CA 12345", "[email protected]", [si1, si2])
+si1 = EmailSocialIcon("https://react.email/static/x-logo.png", "X", "https://x.com/acme")
+si2 = EmailSocialIcon("https://react.email/static/instagram-logo.png", "Instagram", "https://instagram.com/acme")
+
+## Important Rules
+- ALWAYS start with root = EmailTemplate(...)
+- Write statements in TOP-DOWN order: root → components → data (leverages hoisting for progressive streaming)
+- Each statement on its own line
+- No trailing text or explanations — output ONLY openui-lang code
+- When asked about data, generate realistic/plausible data
+- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
+- NEVER define a variable without referencing it from the tree. Every variable must be reachable from root, otherwise it will not render.
+
+- You are an expert email designer using react-email components.
+- The 10 supported email types are: Welcome/Onboarding, Newsletter, Order Confirmation, Password Reset, Promotional/Sale, Event Invitation, Feedback Request, Shipping/Delivery Update, Account Verification, Onboarding Tutorial.
+- Use realistic, professional placeholder text — never use lorem ipsum.
+- Always provide both subject and previewText for EmailTemplate.
+- Use EmailSection to group related content areas (header, body, footer sections).
+- Use EmailDivider between major sections for visual separation.
+- For multi-column layouts (features, pricing comparisons), use EmailColumns with EmailColumn children.
+- Keep email designs clean and focused — avoid too many colors or fonts.
+- Use EmailButton with descriptive labels and realistic href URLs.
+- For images, use publicly accessible URLs like https://picsum.photos/seed/KEYWORD/600/300.
+- When the user asks to modify an existing email, regenerate the full EmailTemplate with the requested changes applied.
+- Use EmailCodeBlock for multi-line code (API examples, install commands). Set the language prop for syntax context.
+- Use EmailCodeInline for short inline code references within EmailText (e.g. variable names, CLI commands).
+- Use EmailMarkdown when the content includes rich formatting like bold, italic, links, or lists — it's more flexible than plain EmailText.
+- Use EmailHeaderSideNav for a professional header with logo left and nav links right.
+- Use EmailHeaderCenteredNav for a centered brand header with logo on top and nav links below.
+- Use EmailHeaderSocial for a header with logo left and social media icons right.
+- Place the header as the FIRST child of EmailTemplate, followed by an EmailDivider.
+- Use EmailFooterCentered for a centered footer with logo, company name, social icons, and contact info.
+- Use EmailFooterTwoColumn for a two-column footer with logo and info on the left, social icons and address on the right.
+- Place the footer as the LAST child of EmailTemplate, after an EmailDivider.
+- Use EmailArticle for blog post or newsletter article blocks with hero image, category, title, description, and CTA.
+- Use EmailProductCard for product showcases with image, title, description, price, and buy button.
+- Use EmailFeatureGrid for a 2x2 grid of features with icons. Provide exactly 4 EmailFeatureItem children.
+- Use EmailFeatureList for a vertical list of features with icons and dividers. Any number of EmailFeatureItem children.
+- Use EmailNumberedSteps for step-by-step guides. Steps are auto-numbered. Provide EmailStepItem children.
+- Use EmailCheckoutTable for cart/order summary tables. Provide EmailCheckoutItem children with product details.
+- Use EmailPricingCard for pricing plans with feature lists. Provide EmailPricingFeature children for each feature line.
+- Use EmailTestimonial for customer quotes with avatar, name, and role.
+- Use EmailSurveyRating for feedback/NPS emails with a 1-5 rating scale.
+- Use EmailStats for displaying key metrics. Provide EmailStatItem children with value and label.
+- Use EmailImageGrid for a 2x2 image gallery. Provide up to 4 EmailImage children.
+- Use EmailAvatar for a single avatar image. Set rounded='full' for circular or rounded='md' for rounded-square. Default size is 42px.
+- Use EmailAvatarGroup for overlapping stacked avatars. Provide EmailAvatar children. Great for showing team members or participants.
+- Use EmailAvatarWithText for an avatar with name and role text. Optionally wrap in a link with href. Great for author attribution in articles.
+- Use EmailList for numbered lists with circular badges. Provide EmailListItem children with title and description.
+- Use EmailCustomerReview for a star rating distribution summary. Provide counts for each rating level (rating1-rating5) and totalReviews.
+- Use EmailBentoGrid for a bento-style marketing layout. Provide a dark hero section and EmailBentoItem children for product cards below.
\ No newline at end of file
diff --git a/examples/react-email/src/hooks/useAutoScroll.ts b/examples/react-email/src/hooks/useAutoScroll.ts
new file mode 100644
index 000000000..bf4b1da28
--- /dev/null
+++ b/examples/react-email/src/hooks/useAutoScroll.ts
@@ -0,0 +1,57 @@
+"use client";
+
+import { useEffect, useRef } from "react";
+
+export function useAutoScroll(deps: unknown[], isRunning: boolean) {
+ const ref = useRef<HTMLDivElement>(null);
+ const userScrolledRef = useRef(false);
+ const isUserScrollingRef = useRef(false);
+
+ useEffect(() => {
+ const el = ref.current;
+ if (!el) return;
+
+ const onUserStart = () => {
+ isUserScrollingRef.current = true;
+ };
+ const onUserEnd = () => {
+ isUserScrollingRef.current = false;
+ };
+ const onScroll = () => {
+ if (isUserScrollingRef.current) {
+ userScrolledRef.current = true;
+ }
+ };
+
+ el.addEventListener("mousedown", onUserStart);
+ el.addEventListener("touchstart", onUserStart);
+ el.addEventListener("wheel", onUserStart);
+ el.addEventListener("click", onUserEnd);
+ el.addEventListener("scroll", onScroll);
+
+ return () => {
+ el.removeEventListener("mousedown", onUserStart);
+ el.removeEventListener("touchstart", onUserStart);
+ el.removeEventListener("wheel", onUserStart);
+ el.removeEventListener("click", onUserEnd);
+ el.removeEventListener("scroll", onScroll);
+ };
+ }, []);
+
+ // Auto-scroll to bottom when content changes
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ useEffect(() => {
+ if (ref.current && !userScrolledRef.current) {
+ ref.current.scrollTop = ref.current.scrollHeight;
+ }
+ }, deps);
+
+ // Reset scroll lock when a new generation starts
+ useEffect(() => {
+ if (isRunning) {
+ userScrolledRef.current = false;
+ }
+ }, [isRunning]);
+
+ return ref;
+}
diff --git a/examples/react-email/src/hooks/useClipboard.ts b/examples/react-email/src/hooks/useClipboard.ts
new file mode 100644
index 000000000..28d443867
--- /dev/null
+++ b/examples/react-email/src/hooks/useClipboard.ts
@@ -0,0 +1,19 @@
+"use client";
+
+import { useCallback, useState } from "react";
+
+export function useClipboard(timeout = 2000) {
+ const [copied, setCopied] = useState(false);
+
+ const copy = useCallback(
+ (text: string) => {
+ navigator.clipboard.writeText(text).then(() => {
+ setCopied(true);
+ setTimeout(() => setCopied(false), timeout);
+ });
+ },
+ [timeout],
+ );
+
+ return { copied, copy };
+}
diff --git a/examples/react-email/src/hooks/useEmailRendering.tsx b/examples/react-email/src/hooks/useEmailRendering.tsx
new file mode 100644
index 000000000..ea5c9a478
--- /dev/null
+++ b/examples/react-email/src/hooks/useEmailRendering.tsx
@@ -0,0 +1,104 @@
+"use client";
+
+import { emailLibrary } from "@openuidev/react-email";
+import type { ParseResult } from "@openuidev/react-lang";
+import { Renderer } from "@openuidev/react-lang";
+import { render } from "@react-email/render";
+import { useCallback, useEffect, useRef, useState } from "react";
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+function findTemplate(node: any): any {
+ if (node?.typeName === "EmailTemplate") return node;
+ const children = node?.props?.children;
+ if (Array.isArray(children)) {
+ for (const child of children) {
+ const found = findTemplate(child);
+ if (found) return found;
+ }
+ }
+ return null;
+}
+
+function renderToHtml(openuiCode: string) {
+ return render(<Renderer response={openuiCode} library={emailLibrary} isStreaming={false} />, {
+ pretty: true,
+ });
+}
+
+export function useEmailRendering(openuiCode: string | null, isStreaming: boolean, isRunning: boolean) {
+ const [renderedHtml, setRenderedHtml] = useState<string | null>(null);
+ const [htmlLoading, setHtmlLoading] = useState(false);
+ const [emailSubject, setEmailSubject] = useState<string | null>(null);
+ const lastParsedRef = useRef<ParseResult | null>(null);
+ const renderingRef = useRef(false);
+ const wasStreamingRef = useRef(false);
+ const wasRunningRef = useRef(false);
+
+ const triggerRender = useCallback(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (template: any, code: string) => {
+ renderingRef.current = true;
+ setHtmlLoading(true);
+ setEmailSubject(String(template.props?.subject ?? ""));
+
+ renderToHtml(code)
+ .then((html) => setRenderedHtml(html))
+ .catch(() => setRenderedHtml(null))
+ .finally(() => {
+ setHtmlLoading(false);
+ renderingRef.current = false;
+ });
+ },
+ [],
+ );
+
+ const handleParseResult = useCallback(
+ (result: ParseResult | null) => {
+ lastParsedRef.current = result;
+
+ // On refresh (not streaming, no HTML yet), render as soon as parse completes
+ if (result?.root && openuiCode && !isStreaming && !renderingRef.current) {
+ const template = findTemplate(result.root);
+ if (template && !renderedHtml) {
+ requestAnimationFrame(() => triggerRender(template, openuiCode));
+ }
+ }
+ },
+ [openuiCode, isStreaming, renderedHtml, triggerRender],
+ );
+
+ const onStreamingEnd = useCallback(() => {
+ if (renderingRef.current || !openuiCode) return;
+ const result = lastParsedRef.current;
+ if (!result?.root) return;
+
+ const template = findTemplate(result.root);
+ if (!template) return;
+
+ triggerRender(template, openuiCode);
+ }, [openuiCode, triggerRender]);
+
+ const onGenerationStart = useCallback(() => {
+ setRenderedHtml(null);
+ setEmailSubject(null);
+ lastParsedRef.current = null;
+ renderingRef.current = false;
+ }, []);
+
+ // Detect streaming/running transitions
+ useEffect(() => {
+ const id = requestAnimationFrame(() => {
+ if (wasStreamingRef.current && !isStreaming) {
+ onStreamingEnd();
+ }
+ if (!wasRunningRef.current && isRunning) {
+ onGenerationStart();
+ }
+ wasStreamingRef.current = isStreaming;
+ wasRunningRef.current = isRunning;
+ });
+ return () => cancelAnimationFrame(id);
+ }, [isStreaming, isRunning, openuiCode, onStreamingEnd, onGenerationStart]);
+
+ return { renderedHtml, htmlLoading, emailSubject, handleParseResult };
+}
diff --git a/examples/react-email/src/hooks/useIsMobile.ts b/examples/react-email/src/hooks/useIsMobile.ts
new file mode 100644
index 000000000..f0fcdf868
--- /dev/null
+++ b/examples/react-email/src/hooks/useIsMobile.ts
@@ -0,0 +1,14 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+export function useIsMobile(breakpoint = 768) {
+ const [isMobile, setIsMobile] = useState(false);
+ useEffect(() => {
+ const check = () => setIsMobile(window.innerWidth < breakpoint);
+ check();
+ window.addEventListener("resize", check);
+ return () => window.removeEventListener("resize", check);
+ }, [breakpoint]);
+ return isMobile;
+}
diff --git a/examples/react-email/tsconfig.json b/examples/react-email/tsconfig.json
new file mode 100644
index 000000000..cf9c65d3e
--- /dev/null
+++ b/examples/react-email/tsconfig.json
@@ -0,0 +1,34 @@
+{
+ "compilerOptions": {
+ "target": "ES2017",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "react-jsx",
+ "incremental": true,
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".next/types/**/*.ts",
+ ".next/dev/types/**/*.ts",
+ "**/*.mts"
+ ],
+ "exclude": ["node_modules"]
+}
diff --git a/packages/react-email/package.json b/packages/react-email/package.json
new file mode 100644
index 000000000..13d5a8725
--- /dev/null
+++ b/packages/react-email/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "@openuidev/react-email",
+ "version": "0.1.0",
+ "description": "React Email components for OpenUI \u2014 44 email building blocks with defineComponent",
+ "type": "module",
+ "main": "src/index.ts",
+ "types": "src/index.ts",
+ "exports": {
+ ".": {
+ "types": "./src/index.ts",
+ "default": "./src/index.ts"
+ }
+ },
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "build": "tsc -p tsconfig.build.json",
+ "dev": "tsc -p tsconfig.build.json --watch",
+ "lint": "eslint",
+ "lint:check": "eslint ./src",
+ "lint:fix": "eslint ./src --fix",
+ "format:fix": "prettier --write ./src",
+ "format:check": "prettier --check ./src",
+ "ci": "pnpm run lint:check && pnpm run format:check"
+ },
+ "dependencies": {
+ "@react-email/components": "^0.0.41",
+ "zod": "^4.3.6"
+ },
+ "peerDependencies": {
+ "@openuidev/react-lang": "workspace:*",
+ "react": ">=19.0.0",
+ "react-dom": ">=19.0.0"
+ },
+ "devDependencies": {
+ "@types/react": "^19",
+ "typescript": "^5"
+ }
+}
diff --git a/packages/react-email/src/components/Article.tsx b/packages/react-email/src/components/Article.tsx
new file mode 100644
index 000000000..3a83e9806
--- /dev/null
+++ b/packages/react-email/src/components/Article.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button, Heading, Img, Section, Text } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailArticle = defineComponent({
+ name: "EmailArticle",
+ props: z.object({
+ imageSrc: z.string(),
+ imageAlt: z.string(),
+ category: z.string().optional(),
+ title: z.string(),
+ description: z.string(),
+ buttonLabel: z.string(),
+ buttonHref: z.string(),
+ buttonColor: z.string().optional(),
+ }),
+ description:
+ "Article block with hero image, optional category label, title, description, and CTA button. Great for blog posts and newsletter articles.",
+ component: ({ props }) => {
+ const bg = (props.buttonColor as string) ?? "#4F46E5";
+ return (
+ <Section style={{ marginTop: 16, marginBottom: 16 }}>
+ <Img
+ alt={props.imageAlt as string}
+ height="320"
+ src={props.imageSrc as string}
+ style={{ width: "100%", borderRadius: 12, objectFit: "cover" }}
+ />
+ <Section style={{ marginTop: 32, textAlign: "center" }}>
+ {props.category && (
+ <Text
+ style={{
+ marginTop: 16,
+ marginBottom: 16,
+ fontSize: 18,
+ lineHeight: "28px",
+ fontWeight: 600,
+ color: "#4F46E5",
+ }}
+ >
+ {props.category as string}
+ </Text>
+ )}
+ <Heading
+ as="h1"
+ style={{
+ margin: "0px",
+ marginTop: 8,
+ fontSize: 36,
+ lineHeight: "36px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Heading>
+ <Text style={{ fontSize: 16, lineHeight: "24px", color: "#6B7280" }}>
+ {props.description as string}
+ </Text>
+ <Button
+ href={props.buttonHref as string}
+ style={{
+ marginTop: 16,
+ borderRadius: 8,
+ backgroundColor: bg,
+ paddingLeft: 40,
+ paddingRight: 40,
+ paddingTop: 12,
+ paddingBottom: 12,
+ fontWeight: 600,
+ color: "#ffffff",
+ }}
+ >
+ {props.buttonLabel as string}
+ </Button>
+ </Section>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Avatar.tsx b/packages/react-email/src/components/Avatar.tsx
new file mode 100644
index 000000000..bbbd93496
--- /dev/null
+++ b/packages/react-email/src/components/Avatar.tsx
@@ -0,0 +1,48 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Img } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailAvatar = defineComponent({
+ name: "EmailAvatar",
+ props: z.object({
+ src: z.string(),
+ alt: z.string(),
+ size: z.number().optional(),
+ rounded: z.enum(["full", "md"]).optional(),
+ }),
+ description:
+ "Avatar image component. Supports circular (rounded='full') or rounded-square (rounded='md') shapes, and configurable size.",
+ component: ({ props }) => {
+ const size = (props.size as number) ?? 42;
+ const rounded = (props.rounded as string) ?? "full";
+ const borderRadius = rounded === "full" ? "9999px" : "8px";
+
+ return (
+ <div
+ style={{
+ display: "inline-block",
+ width: size,
+ height: size,
+ borderRadius,
+ overflow: "hidden",
+ backgroundColor: "#1F2937",
+ }}
+ >
+ <Img
+ src={props.src as string}
+ alt={props.alt as string}
+ width={size}
+ height={size}
+ style={{
+ width: "100%",
+ height: "100%",
+ objectFit: "cover",
+ objectPosition: "center",
+ }}
+ />
+ </div>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/AvatarGroup.tsx b/packages/react-email/src/components/AvatarGroup.tsx
new file mode 100644
index 000000000..0ced068d0
--- /dev/null
+++ b/packages/react-email/src/components/AvatarGroup.tsx
@@ -0,0 +1,77 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Row } from "@react-email/components";
+import { z } from "zod";
+import { EmailAvatar } from "./Avatar";
+
+export const EmailAvatarGroup = defineComponent({
+ name: "EmailAvatarGroup",
+ props: z.object({
+ avatars: z.array(EmailAvatar.ref),
+ }),
+ description:
+ "Overlapping stacked avatar group. Pass EmailAvatar items to display them in a horizontal row with negative offset overlap.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const avatars = (props.avatars ?? []) as any[];
+
+ return (
+ <Row
+ style={{
+ borderCollapse: "collapse",
+ borderSpacing: 0,
+ }}
+ >
+ {avatars.map((avatar, i) => {
+ const src = String(avatar?.props?.src ?? "");
+ const alt = String(avatar?.props?.alt ?? "");
+ const size = Number(avatar?.props?.size ?? 44);
+
+ return (
+ <Column
+ key={i}
+ width={String(size)}
+ style={{
+ height: size,
+ width: size,
+ padding: 0,
+ textAlign: "center",
+ verticalAlign: "middle",
+ lineHeight: "0px",
+ position: "relative",
+ left: i > 0 ? -(i * 12) : 0,
+ }}
+ >
+ <div
+ style={{
+ boxSizing: "border-box",
+ height: "100%",
+ width: "100%",
+ overflow: "hidden",
+ borderRadius: "9999px",
+ border: "4px solid #ffffff",
+ backgroundColor: "#1F2937",
+ }}
+ >
+ <Img
+ src={src}
+ alt={alt}
+ width={size - 8}
+ height={size - 8}
+ style={{
+ display: "inline-block",
+ height: "100%",
+ width: "100%",
+ objectFit: "cover",
+ objectPosition: "center",
+ }}
+ />
+ </div>
+ </Column>
+ );
+ })}
+ </Row>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/AvatarWithText.tsx b/packages/react-email/src/components/AvatarWithText.tsx
new file mode 100644
index 000000000..914ea17ac
--- /dev/null
+++ b/packages/react-email/src/components/AvatarWithText.tsx
@@ -0,0 +1,102 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailAvatarWithText = defineComponent({
+ name: "EmailAvatarWithText",
+ props: z.object({
+ avatarSrc: z.string(),
+ avatarAlt: z.string(),
+ name: z.string(),
+ role: z.string(),
+ href: z.string().optional(),
+ }),
+ description:
+ "Avatar with name and role text beside it. Optionally wraps in a link. Great for author attribution or team member display.",
+ component: ({ props }) => {
+ const content = (
+ <Row
+ style={{
+ width: "auto",
+ tableLayout: "fixed",
+ borderCollapse: "collapse",
+ borderSpacing: 0,
+ }}
+ >
+ <Column
+ style={{
+ height: 44,
+ width: 44,
+ overflow: "hidden",
+ borderRadius: "9999px",
+ padding: 0,
+ textAlign: "center",
+ verticalAlign: "middle",
+ lineHeight: "0px",
+ }}
+ >
+ <Img
+ src={props.avatarSrc as string}
+ width={36}
+ height={36}
+ alt={props.avatarAlt as string}
+ style={{
+ height: "100%",
+ width: "100%",
+ objectFit: "cover",
+ objectPosition: "center",
+ }}
+ />
+ </Column>
+ <Column
+ style={{
+ paddingLeft: 12,
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 500,
+ color: "#6B7280",
+ }}
+ >
+ <p
+ style={{
+ margin: 0,
+ color: "#374151",
+ fontWeight: 600,
+ }}
+ >
+ {props.name as string}
+ </p>
+ <p
+ style={{
+ margin: 0,
+ fontSize: 12,
+ lineHeight: "14px",
+ }}
+ >
+ {props.role as string}
+ </p>
+ </Column>
+ </Row>
+ );
+
+ if (props.href) {
+ return (
+ <Row>
+ <Column align="center">
+ <Link href={props.href as string} style={{ textDecoration: "none", color: "inherit" }}>
+ {content}
+ </Link>
+ </Column>
+ </Row>
+ );
+ }
+
+ return (
+ <Row>
+ <Column align="center">{content}</Column>
+ </Row>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/BentoGrid.tsx b/packages/react-email/src/components/BentoGrid.tsx
new file mode 100644
index 000000000..4cf36ce0f
--- /dev/null
+++ b/packages/react-email/src/components/BentoGrid.tsx
@@ -0,0 +1,157 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Heading, Img, Link, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailBentoItem } from "./BentoItem";
+
+export const EmailBentoGrid = defineComponent({
+ name: "EmailBentoGrid",
+ props: z.object({
+ heroTitle: z.string(),
+ heroDescription: z.string(),
+ heroLinkText: z.string().optional(),
+ heroLinkHref: z.string().optional(),
+ heroImageSrc: z.string(),
+ heroImageAlt: z.string(),
+ items: z.array(EmailBentoItem.ref),
+ }),
+ description:
+ "Bento grid layout with a dark hero section (title, description, link, image) on top and a row of product cards below. Pass EmailBentoItem children for the bottom row. Great for marketing and product showcase emails.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+
+ return (
+ <Section style={{ overflow: "hidden" }}>
+ {/* Hero section */}
+ <Section>
+ <Row
+ style={{
+ backgroundColor: "#292524",
+ margin: 0,
+ tableLayout: "fixed",
+ width: "100%",
+ }}
+ >
+ <Column style={{ padding: 24 }}>
+ <Heading
+ as="h1"
+ style={{
+ color: "#ffffff",
+ fontSize: 28,
+ fontWeight: 700,
+ marginBottom: 10,
+ marginTop: 0,
+ }}
+ >
+ {props.heroTitle as string}
+ </Heading>
+ <Text
+ style={{
+ color: "rgba(255,255,255,0.6)",
+ fontSize: 14,
+ lineHeight: "20px",
+ margin: 0,
+ }}
+ >
+ {props.heroDescription as string}
+ </Text>
+ {props.heroLinkText && props.heroLinkHref && (
+ <Link
+ href={props.heroLinkHref as string}
+ style={{
+ color: "rgba(255,255,255,0.8)",
+ display: "block",
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 600,
+ marginTop: 12,
+ textDecoration: "none",
+ }}
+ >
+ {props.heroLinkText as string} →
+ </Link>
+ )}
+ </Column>
+ <Column style={{ width: "42%", height: 250 }}>
+ <Img
+ src={props.heroImageSrc as string}
+ alt={props.heroImageAlt as string}
+ style={{
+ borderRadius: 4,
+ height: "100%",
+ objectFit: "cover",
+ objectPosition: "center",
+ width: "100%",
+ }}
+ />
+ </Column>
+ </Row>
+ </Section>
+
+ {/* Items row */}
+ {items.length > 0 && (
+ <Section style={{ marginBottom: 24 }}>
+ <Row
+ style={{
+ tableLayout: "fixed",
+ width: "100%",
+ }}
+ >
+ {items.map((item, i) => {
+ const imageSrc = String(item?.props?.imageSrc ?? "");
+ const imageAlt = String(item?.props?.imageAlt ?? "");
+ const title = String(item?.props?.title ?? "");
+ const description = String(item?.props?.description ?? "");
+
+ return (
+ <Column
+ key={i}
+ style={{
+ padding: 12,
+ }}
+ >
+ <Img
+ src={imageSrc}
+ alt={imageAlt}
+ style={{
+ borderRadius: 4,
+ marginBottom: 18,
+ width: "100%",
+ }}
+ />
+ <Heading
+ as="h3"
+ style={{
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 700,
+ marginBottom: 8,
+ marginTop: 0,
+ color: "#111827",
+ }}
+ >
+ {title}
+ </Heading>
+ <Text
+ style={{
+ color: "#6B7280",
+ fontSize: 12,
+ lineHeight: "20px",
+ margin: 0,
+ paddingRight: 12,
+ }}
+ >
+ {description}
+ </Text>
+ </Column>
+ );
+ })}
+ </Row>
+ </Section>
+ )}
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/BentoItem.tsx b/packages/react-email/src/components/BentoItem.tsx
new file mode 100644
index 000000000..ad05ce4b0
--- /dev/null
+++ b/packages/react-email/src/components/BentoItem.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailBentoItem = defineComponent({
+ name: "EmailBentoItem",
+ props: z.object({
+ imageSrc: z.string(),
+ imageAlt: z.string(),
+ title: z.string(),
+ description: z.string(),
+ }),
+ description:
+ "Data-only bento grid item with image, title, and description. Used as a child inside EmailBentoGrid.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/Button.tsx b/packages/react-email/src/components/Button.tsx
new file mode 100644
index 000000000..87a1041d1
--- /dev/null
+++ b/packages/react-email/src/components/Button.tsx
@@ -0,0 +1,34 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailButton = defineComponent({
+ name: "EmailButton",
+ props: z.object({
+ label: z.string(),
+ href: z.string(),
+ backgroundColor: z.string().optional(),
+ }),
+ description: "Email call-to-action button with link.",
+ component: ({ props }) => (
+ <Button
+ href={props.href as string}
+ style={{
+ backgroundColor: (props.backgroundColor as string) ?? "#5F51E8",
+ color: "#ffffff",
+ borderRadius: "6px",
+ padding: "12px 24px",
+ fontSize: "16px",
+ fontWeight: "bold",
+ textDecoration: "none",
+ textAlign: "center" as const,
+ display: "inline-block",
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {props.label as string}
+ </Button>
+ ),
+});
diff --git a/packages/react-email/src/components/CheckoutItem.tsx b/packages/react-email/src/components/CheckoutItem.tsx
new file mode 100644
index 000000000..5b569a301
--- /dev/null
+++ b/packages/react-email/src/components/CheckoutItem.tsx
@@ -0,0 +1,18 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailCheckoutItem = defineComponent({
+ name: "EmailCheckoutItem",
+ props: z.object({
+ imageSrc: z.string().optional(),
+ imageAlt: z.string().optional(),
+ name: z.string(),
+ quantity: z.number().optional(),
+ price: z.string(),
+ }),
+ description:
+ "Single checkout/cart item with optional image, name, quantity, and price. Used inside EmailCheckoutTable.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/CheckoutTable.tsx b/packages/react-email/src/components/CheckoutTable.tsx
new file mode 100644
index 000000000..4423c314a
--- /dev/null
+++ b/packages/react-email/src/components/CheckoutTable.tsx
@@ -0,0 +1,202 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button, Column, Heading, Img, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailCheckoutItem } from "./CheckoutItem";
+
+export const EmailCheckoutTable = defineComponent({
+ name: "EmailCheckoutTable",
+ props: z.object({
+ title: z.string().optional(),
+ items: z.array(EmailCheckoutItem.ref),
+ buttonLabel: z.string(),
+ buttonHref: z.string(),
+ buttonColor: z.string().optional(),
+ }),
+ description:
+ "Checkout/cart table with product items (image, name, quantity, price) and a checkout button. Great for abandoned cart and order summary emails.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+ const bg = (props.buttonColor as string) ?? "#4F46E5";
+ const title = (props.title as string) ?? "You left something in your cart";
+
+ return (
+ <Section style={{ paddingTop: 16, paddingBottom: 16, textAlign: "center" }}>
+ <Heading
+ as="h1"
+ style={{
+ fontSize: 30,
+ lineHeight: "36px",
+ marginBottom: "0px",
+ fontWeight: 600,
+ }}
+ >
+ {title}
+ </Heading>
+ <div
+ style={{
+ padding: 16,
+ paddingTop: "0px",
+ marginTop: 16,
+ marginBottom: 16,
+ borderRadius: 8,
+ borderWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <table style={{ marginBottom: 16 }} width="100%">
+ <thead>
+ <tr>
+ <th
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ &nbsp;
+ </th>
+ <th
+ align="left"
+ colSpan={6}
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ color: "#6B7280",
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text style={{ fontWeight: 600 }}>Product</Text>
+ </th>
+ <th
+ align="center"
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ color: "#6B7280",
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text style={{ fontWeight: 600 }}>Qty</Text>
+ </th>
+ <th
+ align="center"
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ color: "#6B7280",
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text style={{ fontWeight: 600 }}>Price</Text>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {items.map((item, i) => (
+ <tr key={i}>
+ <td
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ {item?.props?.imageSrc ? (
+ <Img
+ alt={String(item?.props?.imageAlt ?? item?.props?.name ?? "")}
+ height={110}
+ src={String(item?.props?.imageSrc)}
+ style={{ objectFit: "cover", borderRadius: 8 }}
+ />
+ ) : null}
+ </td>
+ <td
+ align="left"
+ colSpan={6}
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text>{String(item?.props?.name ?? "")}</Text>
+ </td>
+ <td
+ align="center"
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text>{String(item?.props?.quantity ?? 1)}</Text>
+ </td>
+ <td
+ align="center"
+ style={{
+ paddingTop: 8,
+ paddingBottom: 8,
+ borderWidth: "0px",
+ borderBottomWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#E5E7EB",
+ }}
+ >
+ <Text>{String(item?.props?.price ?? "")}</Text>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ <Row>
+ <Column align="center">
+ <Button
+ href={props.buttonHref as string}
+ style={{
+ width: "100%",
+ boxSizing: "border-box",
+ paddingLeft: 12,
+ paddingRight: 12,
+ borderRadius: 8,
+ textAlign: "center",
+ backgroundColor: bg,
+ paddingTop: 12,
+ paddingBottom: 12,
+ fontWeight: 600,
+ color: "#ffffff",
+ }}
+ >
+ {props.buttonLabel as string}
+ </Button>
+ </Column>
+ </Row>
+ </div>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/CodeBlock.tsx b/packages/react-email/src/components/CodeBlock.tsx
new file mode 100644
index 000000000..eb8c6992f
--- /dev/null
+++ b/packages/react-email/src/components/CodeBlock.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { CodeBlock } from "@react-email/components";
+import { z } from "zod";
+
+type PrismLanguage = Parameters<typeof CodeBlock>[0]["language"];
+
+export const EmailCodeBlock = defineComponent({
+ name: "EmailCodeBlock",
+ props: z.object({
+ code: z.string(),
+ language: z.string().optional(),
+ }),
+ description: "Syntax-highlighted code block for displaying code snippets in emails.",
+ component: ({ props }) => (
+ <CodeBlock
+ code={props.code as string}
+ language={((props.language as string) ?? "javascript") as PrismLanguage}
+ theme={{
+ base: {
+ backgroundColor: "#1e1e1e",
+ color: "#d4d4d4",
+ padding: "16px",
+ borderRadius: "6px",
+ fontSize: "14px",
+ lineHeight: "1.5",
+ overflow: "auto",
+ margin: "0 0 16px 0",
+ fontFamily: "'Fira Code', 'Courier New', monospace",
+ },
+ }}
+ />
+ ),
+});
diff --git a/packages/react-email/src/components/CodeInline.tsx b/packages/react-email/src/components/CodeInline.tsx
new file mode 100644
index 000000000..767bfec3a
--- /dev/null
+++ b/packages/react-email/src/components/CodeInline.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { CodeInline } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailCodeInline = defineComponent({
+ name: "EmailCodeInline",
+ props: z.object({
+ code: z.string(),
+ }),
+ description: "Inline code snippet for embedding code within text.",
+ component: ({ props }) => (
+ <CodeInline
+ style={{
+ backgroundColor: "#f3f4f6",
+ color: "#e11d48",
+ padding: "2px 6px",
+ borderRadius: "4px",
+ fontSize: "14px",
+ fontFamily: "'Fira Code', 'Courier New', monospace",
+ }}
+ >
+ {props.code as string}
+ </CodeInline>
+ ),
+});
diff --git a/packages/react-email/src/components/Column.tsx b/packages/react-email/src/components/Column.tsx
new file mode 100644
index 000000000..9c6f23011
--- /dev/null
+++ b/packages/react-email/src/components/Column.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column } from "@react-email/components";
+import { z } from "zod";
+import { EmailLeafChildUnion } from "../unions";
+
+export const EmailColumn = defineComponent({
+ name: "EmailColumn",
+ props: z.object({
+ children: z.array(EmailLeafChildUnion),
+ }),
+ description: "A single column within an EmailColumns row.",
+ component: ({ props, renderNode }) => (
+ <Column style={{ verticalAlign: "top" }}>{renderNode(props.children)}</Column>
+ ),
+});
diff --git a/packages/react-email/src/components/Columns.tsx b/packages/react-email/src/components/Columns.tsx
new file mode 100644
index 000000000..22c0684a5
--- /dev/null
+++ b/packages/react-email/src/components/Columns.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Row } from "@react-email/components";
+import { z } from "zod";
+import { EmailColumn } from "./Column";
+
+export const EmailColumns = defineComponent({
+ name: "EmailColumns",
+ props: z.object({
+ children: z.array(EmailColumn.ref),
+ }),
+ description: "Multi-column row layout. Contains EmailColumn children.",
+ component: ({ props, renderNode }) => (
+ <Row style={{ margin: "0 0 16px 0" }}>{renderNode(props.children)}</Row>
+ ),
+});
diff --git a/packages/react-email/src/components/CustomerReview.tsx b/packages/react-email/src/components/CustomerReview.tsx
new file mode 100644
index 000000000..dd733eed6
--- /dev/null
+++ b/packages/react-email/src/components/CustomerReview.tsx
@@ -0,0 +1,164 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button, Column, Heading, Hr, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailCustomerReview = defineComponent({
+ name: "EmailCustomerReview",
+ props: z.object({
+ title: z.string().optional(),
+ totalReviews: z.number(),
+ rating5: z.number(),
+ rating4: z.number(),
+ rating3: z.number(),
+ rating2: z.number(),
+ rating1: z.number(),
+ buttonLabel: z.string().optional(),
+ buttonHref: z.string().optional(),
+ buttonColor: z.string().optional(),
+ }),
+ description:
+ "Customer review summary with star rating distribution bars showing percentages for each rating (1-5). Includes total review count and optional CTA button to write a review.",
+ component: ({ props }) => {
+ const title = (props.title as string) ?? "Customer Reviews";
+ const totalReviews = props.totalReviews as number;
+ const ratings = [
+ { rating: 5, count: props.rating5 as number },
+ { rating: 4, count: props.rating4 as number },
+ { rating: 3, count: props.rating3 as number },
+ { rating: 2, count: props.rating2 as number },
+ { rating: 1, count: props.rating1 as number },
+ ];
+ const buttonLabel = (props.buttonLabel as string) ?? "Write a review";
+ const buttonHref = (props.buttonHref as string) ?? "#";
+ const buttonColor = (props.buttonColor as string) ?? "#4F46E5";
+
+ return (
+ <Section>
+ <Heading as="h2" style={{ fontSize: 24, lineHeight: "32px", color: "#111827" }}>
+ {title}
+ </Heading>
+ <Section style={{ marginTop: 24, marginBottom: 24 }}>
+ {ratings.map(({ rating, count }) => {
+ const pct = totalReviews > 0 ? Math.round((count / totalReviews) * 100) : 0;
+ const filledPct =
+ totalReviews > 0 ? `${Math.round((count / totalReviews) * 100)}%` : "0%";
+
+ return (
+ <Row
+ key={rating}
+ style={{
+ fontSize: 14,
+ lineHeight: "20px",
+ marginBottom: 4,
+ }}
+ >
+ <Column
+ width="24"
+ style={{
+ width: 24,
+ fontWeight: 500,
+ color: "#6B7280",
+ textAlign: "right",
+ paddingRight: 8,
+ }}
+ >
+ {rating}
+ </Column>
+ <Column valign="middle" style={{ paddingLeft: 4 }}>
+ <div
+ style={{
+ width: "100%",
+ height: 12,
+ backgroundColor: "#F3F4F6",
+ borderRadius: 6,
+ border: "1px solid #E5E7EB",
+ overflow: "hidden",
+ }}
+ >
+ <div
+ style={{
+ width: filledPct,
+ height: "100%",
+ backgroundColor: buttonColor,
+ borderRadius: 6,
+ }}
+ />
+ </div>
+ </Column>
+ <Column
+ width="48"
+ style={{
+ width: 48,
+ paddingLeft: 12,
+ fontWeight: 500,
+ color: "#6B7280",
+ fontSize: 12,
+ }}
+ >
+ {pct}%
+ </Column>
+ </Row>
+ );
+ })}
+ <Text
+ style={{
+ marginTop: 14,
+ textAlign: "center",
+ color: "#6B7280",
+ fontSize: 12,
+ lineHeight: "24px",
+ }}
+ >
+ Based on <span style={{ fontWeight: 600 }}>{totalReviews}</span> Reviews
+ </Text>
+ </Section>
+ <Hr style={{ borderColor: "#E5E7EB" }} />
+ <Section style={{ marginTop: 30 }}>
+ <Heading
+ as="h3"
+ style={{
+ marginBottom: 12,
+ fontWeight: 500,
+ color: "#111827",
+ fontSize: 18,
+ lineHeight: "24px",
+ }}
+ >
+ Share your thoughts
+ </Heading>
+ <Text
+ style={{
+ margin: 0,
+ color: "#6B7280",
+ fontSize: 14,
+ lineHeight: "20px",
+ }}
+ >
+ If you&apos;ve used this product, share your thoughts with other customers
+ </Text>
+ <Button
+ href={buttonHref}
+ style={{
+ marginTop: 26,
+ marginBottom: 24,
+ display: "inline-block",
+ width: "100%",
+ borderRadius: 8,
+ backgroundColor: buttonColor,
+ padding: 12,
+ textAlign: "center",
+ boxSizing: "border-box",
+ fontWeight: 600,
+ color: "#ffffff",
+ fontSize: 14,
+ }}
+ >
+ {buttonLabel}
+ </Button>
+ </Section>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Divider.tsx b/packages/react-email/src/components/Divider.tsx
new file mode 100644
index 000000000..19362bbfb
--- /dev/null
+++ b/packages/react-email/src/components/Divider.tsx
@@ -0,0 +1,12 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Hr } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailDivider = defineComponent({
+ name: "EmailDivider",
+ props: z.object({}),
+ description: "Horizontal divider line to separate email sections.",
+ component: () => <Hr style={{ borderColor: "#e5e7eb", margin: "24px 0" }} />,
+});
diff --git a/packages/react-email/src/components/FeatureGrid.tsx b/packages/react-email/src/components/FeatureGrid.tsx
new file mode 100644
index 000000000..f790b8197
--- /dev/null
+++ b/packages/react-email/src/components/FeatureGrid.tsx
@@ -0,0 +1,95 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailFeatureItem } from "./FeatureItem";
+
+export const EmailFeatureGrid = defineComponent({
+ name: "EmailFeatureGrid",
+ props: z.object({
+ title: z.string(),
+ description: z.string(),
+ items: z.array(EmailFeatureItem.ref),
+ }),
+ description:
+ "2x2 feature grid with header title, description, and four feature items each with icon, title, and description.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+
+ return (
+ <Section style={{ marginTop: 16, marginBottom: 16 }}>
+ <Row>
+ <Text
+ style={{
+ margin: "0px",
+ fontSize: 24,
+ lineHeight: "32px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Text>
+ <Text
+ style={{
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ </Row>
+ {[0, 2].map((startIdx) => (
+ <Row key={startIdx} style={{ marginTop: startIdx === 0 ? 16 : 32 }}>
+ {items.slice(startIdx, startIdx + 2).map((item, i) => (
+ <Column
+ key={i}
+ colSpan={1}
+ style={{
+ width: "50%",
+ paddingRight: i === 0 ? 12 : 0,
+ paddingLeft: i === 1 ? 12 : 0,
+ verticalAlign: "baseline",
+ }}
+ >
+ <Img
+ alt={String(item?.props?.iconAlt ?? "")}
+ height="48"
+ src={String(item?.props?.iconSrc ?? "")}
+ width="48"
+ />
+ <Text
+ style={{
+ margin: "0px",
+ marginTop: 16,
+ fontSize: 20,
+ lineHeight: "28px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {String(item?.props?.title ?? "")}
+ </Text>
+ <Text
+ style={{
+ marginBottom: "0px",
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {String(item?.props?.description ?? "")}
+ </Text>
+ </Column>
+ ))}
+ </Row>
+ ))}
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/FeatureItem.tsx b/packages/react-email/src/components/FeatureItem.tsx
new file mode 100644
index 000000000..7e15b8149
--- /dev/null
+++ b/packages/react-email/src/components/FeatureItem.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailFeatureItem = defineComponent({
+ name: "EmailFeatureItem",
+ props: z.object({
+ iconSrc: z.string(),
+ iconAlt: z.string(),
+ title: z.string(),
+ description: z.string(),
+ }),
+ description:
+ "Single feature item with icon, title, and description. Used inside EmailFeatureGrid or EmailFeatureList.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/FeatureList.tsx b/packages/react-email/src/components/FeatureList.tsx
new file mode 100644
index 000000000..83227b0b3
--- /dev/null
+++ b/packages/react-email/src/components/FeatureList.tsx
@@ -0,0 +1,105 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Hr, Img, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailFeatureItem } from "./FeatureItem";
+
+export const EmailFeatureList = defineComponent({
+ name: "EmailFeatureList",
+ props: z.object({
+ title: z.string(),
+ description: z.string(),
+ items: z.array(EmailFeatureItem.ref),
+ }),
+ description:
+ "Vertical feature list with header title, description, and feature items separated by dividers. Each item has an icon, title, and description.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+
+ return (
+ <Section style={{ marginTop: 16, marginBottom: 16 }}>
+ <Section>
+ <Row>
+ <Text
+ style={{
+ margin: "0px",
+ fontSize: 24,
+ lineHeight: "32px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Text>
+ <Text
+ style={{
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ </Row>
+ </Section>
+ <Section>
+ {items.map((item, i) => (
+ <div key={i}>
+ <Hr
+ style={{
+ marginLeft: "0px",
+ marginRight: "0px",
+ marginTop: 32,
+ marginBottom: 32,
+ width: "100%",
+ borderWidth: 1,
+ borderStyle: "solid",
+ borderColor: "#D1D5DB",
+ }}
+ />
+ <Section>
+ <Row>
+ <Column style={{ verticalAlign: "baseline" }}>
+ <Img
+ alt={String(item?.props?.iconAlt ?? "")}
+ height="48"
+ src={String(item?.props?.iconSrc ?? "")}
+ width="48"
+ />
+ </Column>
+ <Column style={{ width: "85%" }}>
+ <Text
+ style={{
+ margin: "0px",
+ fontSize: 20,
+ fontWeight: 600,
+ lineHeight: "28px",
+ color: "#111827",
+ }}
+ >
+ {String(item?.props?.title ?? "")}
+ </Text>
+ <Text
+ style={{
+ margin: "0px",
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {String(item?.props?.description ?? "")}
+ </Text>
+ </Column>
+ </Row>
+ </Section>
+ </div>
+ ))}
+ </Section>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/FooterCentered.tsx b/packages/react-email/src/components/FooterCentered.tsx
new file mode 100644
index 000000000..e40cb70ca
--- /dev/null
+++ b/packages/react-email/src/components/FooterCentered.tsx
@@ -0,0 +1,128 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailSocialIcon } from "./SocialIcon";
+
+export const EmailFooterCentered = defineComponent({
+ name: "EmailFooterCentered",
+ props: z.object({
+ logoSrc: z.string(),
+ logoAlt: z.string(),
+ companyName: z.string(),
+ tagline: z.string().optional(),
+ address: z.string(),
+ contact: z.string().optional(),
+ icons: z.array(EmailSocialIcon.ref).optional(),
+ }),
+ description:
+ "Centered footer with logo, company name, tagline, social icons, address, and contact info. Uses EmailSocialIcon items.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const icons = (props.icons ?? []) as any[];
+
+ return (
+ <Section style={{ textAlign: "center" }}>
+ <table style={{ width: "100%" }}>
+ <tbody>
+ <tr style={{ width: "100%" }}>
+ <td align="center">
+ <Img
+ alt={props.logoAlt as string}
+ height="42"
+ src={props.logoSrc as string}
+ width="42"
+ />
+ </td>
+ </tr>
+ <tr style={{ width: "100%" }}>
+ <td align="center">
+ <Text
+ style={{
+ margin: "8px 0",
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#111827",
+ lineHeight: "24px",
+ }}
+ >
+ {props.companyName as string}
+ </Text>
+ {props.tagline && (
+ <Text
+ style={{
+ marginTop: "4px",
+ marginBottom: 0,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.tagline as string}
+ </Text>
+ )}
+ </td>
+ </tr>
+ {icons.length > 0 && (
+ <tr>
+ <td align="center">
+ <Row
+ style={{
+ display: "table-cell",
+ height: "44px",
+ width: "56px",
+ verticalAlign: "bottom",
+ }}
+ >
+ {icons.map((icon, i) => (
+ <Column key={i} style={{ paddingRight: i < icons.length - 1 ? "8px" : 0 }}>
+ <Link href={String(icon?.props?.href ?? "#")}>
+ <Img
+ alt={String(icon?.props?.alt ?? "")}
+ height="36"
+ src={String(icon?.props?.src ?? "")}
+ width="36"
+ />
+ </Link>
+ </Column>
+ ))}
+ </Row>
+ </td>
+ </tr>
+ )}
+ <tr>
+ <td align="center">
+ <Text
+ style={{
+ margin: "8px 0",
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.address as string}
+ </Text>
+ {props.contact && (
+ <Text
+ style={{
+ marginTop: "4px",
+ marginBottom: 0,
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.contact as string}
+ </Text>
+ )}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/FooterTwoColumn.tsx b/packages/react-email/src/components/FooterTwoColumn.tsx
new file mode 100644
index 000000000..e596f5df0
--- /dev/null
+++ b/packages/react-email/src/components/FooterTwoColumn.tsx
@@ -0,0 +1,111 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailSocialIcon } from "./SocialIcon";
+
+export const EmailFooterTwoColumn = defineComponent({
+ name: "EmailFooterTwoColumn",
+ props: z.object({
+ logoSrc: z.string(),
+ logoAlt: z.string(),
+ companyName: z.string(),
+ tagline: z.string().optional(),
+ address: z.string(),
+ contact: z.string().optional(),
+ icons: z.array(EmailSocialIcon.ref).optional(),
+ }),
+ description:
+ "Two-column footer with logo and company info on the left, social icons and address on the right. Uses EmailSocialIcon items.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const icons = (props.icons ?? []) as any[];
+
+ return (
+ <Section>
+ <Row>
+ <Column style={{ verticalAlign: "bottom" }}>
+ <Img alt={props.logoAlt as string} height="42" src={props.logoSrc as string} />
+ <Text
+ style={{
+ margin: "8px 0",
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#111827",
+ lineHeight: "24px",
+ }}
+ >
+ {props.companyName as string}
+ </Text>
+ {props.tagline && (
+ <Text
+ style={{
+ marginTop: "4px",
+ marginBottom: 0,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.tagline as string}
+ </Text>
+ )}
+ </Column>
+ <Column align="left" style={{ verticalAlign: "bottom" }}>
+ {icons.length > 0 && (
+ <Row
+ style={{
+ display: "table-cell",
+ height: "44px",
+ width: "56px",
+ verticalAlign: "bottom",
+ }}
+ >
+ {icons.map((icon, i) => (
+ <Column key={i} style={{ paddingRight: i < icons.length - 1 ? "8px" : 0 }}>
+ <Link href={String(icon?.props?.href ?? "#")}>
+ <Img
+ alt={String(icon?.props?.alt ?? "")}
+ height="36"
+ src={String(icon?.props?.src ?? "")}
+ width="36"
+ />
+ </Link>
+ </Column>
+ ))}
+ </Row>
+ )}
+ <Row>
+ <Text
+ style={{
+ margin: "8px 0",
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.address as string}
+ </Text>
+ {props.contact && (
+ <Text
+ style={{
+ marginTop: "4px",
+ marginBottom: 0,
+ fontWeight: 600,
+ fontSize: "16px",
+ color: "#6b7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.contact as string}
+ </Text>
+ )}
+ </Row>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/HeaderCenteredNav.tsx b/packages/react-email/src/components/HeaderCenteredNav.tsx
new file mode 100644
index 000000000..99983b9da
--- /dev/null
+++ b/packages/react-email/src/components/HeaderCenteredNav.tsx
@@ -0,0 +1,59 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row, Section } from "@react-email/components";
+import { z } from "zod";
+import { EmailNavLink } from "./NavLink";
+
+export const EmailHeaderCenteredNav = defineComponent({
+ name: "EmailHeaderCenteredNav",
+ props: z.object({
+ logoSrc: z.string(),
+ logoAlt: z.string(),
+ logoHeight: z.number().optional(),
+ links: z.array(EmailNavLink.ref),
+ }),
+ description:
+ "Header with logo centered on top and navigation links centered below. Uses EmailNavLink items.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const links = (props.links ?? []) as any[];
+
+ return (
+ <Section style={{ padding: "40px 32px", margin: "40px 0" }}>
+ <Row>
+ <Column align="center">
+ <Img alt={props.logoAlt as string} height="42" src={props.logoSrc as string} />
+ </Column>
+ </Row>
+ <Row style={{ marginTop: "40px" }}>
+ <Column align="center">
+ <table>
+ <tbody>
+ <tr>
+ {links.map((link, i) => (
+ <td key={i} style={{ paddingLeft: "8px", paddingRight: "8px" }}>
+ <Link
+ href={String(link?.props?.href ?? "#")}
+ style={{
+ color: "#4b5563",
+ textDecoration: "none",
+ fontSize: "14px",
+ whiteSpace: "nowrap",
+ fontFamily:
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {String(link?.props?.text ?? "")}
+ </Link>
+ </td>
+ ))}
+ </tr>
+ </tbody>
+ </table>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/HeaderSideNav.tsx b/packages/react-email/src/components/HeaderSideNav.tsx
new file mode 100644
index 000000000..7f57867e7
--- /dev/null
+++ b/packages/react-email/src/components/HeaderSideNav.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row, Section } from "@react-email/components";
+import { z } from "zod";
+import { EmailNavLink } from "./NavLink";
+
+export const EmailHeaderSideNav = defineComponent({
+ name: "EmailHeaderSideNav",
+ props: z.object({
+ logoSrc: z.string(),
+ logoAlt: z.string(),
+ logoHeight: z.number().optional(),
+ links: z.array(EmailNavLink.ref),
+ }),
+ description:
+ "Header with logo on the left and navigation links on the right. Uses EmailNavLink items.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const links = (props.links ?? []) as any[];
+
+ return (
+ <Section style={{ padding: "40px 32px", margin: "40px 0" }}>
+ <Row>
+ <Column style={{ width: "80%" }}>
+ <Img alt={props.logoAlt as string} height="42" src={props.logoSrc as string} />
+ </Column>
+ <Column align="right">
+ <Row align="right">
+ {links.map((link, i) => (
+ <Column key={i} style={{ paddingLeft: "8px", paddingRight: "8px" }}>
+ <Link
+ href={String(link?.props?.href ?? "#")}
+ style={{
+ color: "#4b5563",
+ textDecoration: "none",
+ fontSize: "14px",
+ whiteSpace: "nowrap",
+ fontFamily:
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {String(link?.props?.text ?? "")}
+ </Link>
+ </Column>
+ ))}
+ </Row>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/HeaderSocial.tsx b/packages/react-email/src/components/HeaderSocial.tsx
new file mode 100644
index 000000000..6a5b06a4e
--- /dev/null
+++ b/packages/react-email/src/components/HeaderSocial.tsx
@@ -0,0 +1,54 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Link, Row, Section } from "@react-email/components";
+import { z } from "zod";
+import { EmailSocialIcon } from "./SocialIcon";
+
+export const EmailHeaderSocial = defineComponent({
+ name: "EmailHeaderSocial",
+ props: z.object({
+ logoSrc: z.string(),
+ logoAlt: z.string(),
+ logoHeight: z.number().optional(),
+ icons: z.array(EmailSocialIcon.ref),
+ }),
+ description:
+ "Header with logo on the left and social media icon links on the right. Uses EmailSocialIcon items.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const icons = (props.icons ?? []) as any[];
+
+ return (
+ <Section style={{ padding: "32px 40px" }}>
+ <Row>
+ <Column style={{ width: "80%" }}>
+ <Img
+ alt={props.logoAlt as string}
+ width="42"
+ height="42"
+ src={props.logoSrc as string}
+ />
+ </Column>
+ <Column align="right">
+ <Row align="right">
+ {icons.map((icon, i) => (
+ <Column key={i}>
+ <Link href={String(icon?.props?.href ?? "#")}>
+ <Img
+ alt={String(icon?.props?.alt ?? "")}
+ src={String(icon?.props?.src ?? "")}
+ width="36"
+ height="36"
+ style={{ marginLeft: "4px", marginRight: "4px" }}
+ />
+ </Link>
+ </Column>
+ ))}
+ </Row>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Heading.tsx b/packages/react-email/src/components/Heading.tsx
new file mode 100644
index 000000000..5f3ede1fb
--- /dev/null
+++ b/packages/react-email/src/components/Heading.tsx
@@ -0,0 +1,31 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Heading } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailHeading = defineComponent({
+ name: "EmailHeading",
+ props: z.object({
+ text: z.string(),
+ level: z.number().optional(),
+ }),
+ description: "Email heading (h1-h6). Use level 1 for main title, 2 for section headers.",
+ component: ({ props }) => {
+ const level = Math.min(Math.max((props.level as number) ?? 1, 1), 6);
+ const tag = `h${level}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
+ return (
+ <Heading
+ as={tag}
+ style={{
+ color: "#1a1a1a",
+ margin: "0 0 12px 0",
+ fontSize: level === 1 ? "28px" : level === 2 ? "22px" : "18px",
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {props.text as string}
+ </Heading>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Image.tsx b/packages/react-email/src/components/Image.tsx
new file mode 100644
index 000000000..822b9c402
--- /dev/null
+++ b/packages/react-email/src/components/Image.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Img } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailImage = defineComponent({
+ name: "EmailImage",
+ props: z.object({
+ src: z.string(),
+ alt: z.string(),
+ width: z.number().optional(),
+ }),
+ description: "Email image. Use real, publicly accessible URLs.",
+ component: ({ props }) => (
+ <Img
+ src={props.src as string}
+ alt={props.alt as string}
+ width={((props.width as number) ?? 600).toString()}
+ style={{
+ maxWidth: "100%",
+ height: "auto",
+ margin: "0 0 16px 0",
+ borderRadius: "4px",
+ }}
+ />
+ ),
+});
diff --git a/packages/react-email/src/components/ImageGrid.tsx b/packages/react-email/src/components/ImageGrid.tsx
new file mode 100644
index 000000000..d2fc88b58
--- /dev/null
+++ b/packages/react-email/src/components/ImageGrid.tsx
@@ -0,0 +1,89 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailImage } from "./Image";
+
+export const EmailImageGrid = defineComponent({
+ name: "EmailImageGrid",
+ props: z.object({
+ title: z.string().optional(),
+ description: z.string().optional(),
+ images: z.array(EmailImage.ref),
+ }),
+ description:
+ "2x2 image grid layout with optional header title and description. Pass up to 4 EmailImage items. Great for product galleries and portfolios.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const images = (props.images ?? []) as any[];
+
+ return (
+ <Section style={{ marginTop: 16, marginBottom: 16 }}>
+ {(props.title || props.description) && (
+ <Section style={{ marginTop: 42 }}>
+ <Row>
+ {props.title && (
+ <Text
+ style={{
+ margin: "0px",
+ marginTop: 8,
+ fontSize: 24,
+ lineHeight: "32px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Text>
+ )}
+ {props.description && (
+ <Text
+ style={{
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ )}
+ </Row>
+ </Section>
+ )}
+ <Section style={{ marginTop: 16 }}>
+ {[0, 2].map((startIdx) => {
+ const rowImages = images.slice(startIdx, startIdx + 2);
+ if (rowImages.length === 0) return null;
+ return (
+ <Row key={startIdx} style={{ marginTop: startIdx > 0 ? 16 : 0 }}>
+ {rowImages.map((img, i) => (
+ <Column
+ key={i}
+ style={{
+ width: "50%",
+ paddingRight: i === 0 ? 8 : 0,
+ paddingLeft: i === 1 ? 8 : 0,
+ }}
+ >
+ <Img
+ alt={String(img?.props?.alt ?? "")}
+ height={288}
+ src={String(img?.props?.src ?? "")}
+ style={{
+ width: "100%",
+ borderRadius: 12,
+ objectFit: "cover",
+ }}
+ />
+ </Column>
+ ))}
+ </Row>
+ );
+ })}
+ </Section>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Link.tsx b/packages/react-email/src/components/Link.tsx
new file mode 100644
index 000000000..a6675c97c
--- /dev/null
+++ b/packages/react-email/src/components/Link.tsx
@@ -0,0 +1,26 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Link } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailLink = defineComponent({
+ name: "EmailLink",
+ props: z.object({
+ text: z.string(),
+ href: z.string(),
+ }),
+ description: "Inline hyperlink in email content.",
+ component: ({ props }) => (
+ <Link
+ href={props.href as string}
+ style={{
+ color: "#5F51E8",
+ textDecoration: "underline",
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {props.text as string}
+ </Link>
+ ),
+});
diff --git a/packages/react-email/src/components/List.tsx b/packages/react-email/src/components/List.tsx
new file mode 100644
index 000000000..ffed3d96d
--- /dev/null
+++ b/packages/react-email/src/components/List.tsx
@@ -0,0 +1,99 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Heading, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailListItem } from "./ListItem";
+
+export const EmailList = defineComponent({
+ name: "EmailList",
+ props: z.object({
+ title: z.string().optional(),
+ items: z.array(EmailListItem.ref),
+ }),
+ description:
+ "Numbered list with circular number badges and item title + description. Pass EmailListItem children. Great for feature lists, how-it-works sections, and top-N lists.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+
+ return (
+ <Section>
+ {props.title && (
+ <Heading
+ as="h2"
+ style={{
+ marginBottom: 42,
+ textAlign: "center",
+ fontSize: 24,
+ lineHeight: "32px",
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Heading>
+ )}
+ {items.map((item, i) => {
+ const title = String(item?.props?.title ?? "");
+ const description = String(item?.props?.description ?? "");
+ const number = i + 1;
+
+ return (
+ <Section key={i} style={{ marginBottom: 36 }}>
+ <Row style={{ paddingRight: 32, paddingLeft: 12 }}>
+ <Column
+ width="36"
+ valign="top"
+ style={{
+ paddingRight: 12,
+ width: 36,
+ }}
+ >
+ <div
+ style={{
+ height: 28,
+ width: 28,
+ borderRadius: "9999px",
+ backgroundColor: "#4F46E5",
+ fontWeight: 600,
+ color: "#ffffff",
+ fontSize: 12,
+ lineHeight: "28px",
+ textAlign: "center",
+ }}
+ >
+ {number}
+ </div>
+ </Column>
+ <Column valign="top">
+ <Heading
+ as="h3"
+ style={{
+ marginTop: 0,
+ marginBottom: 8,
+ color: "#111827",
+ fontSize: 18,
+ lineHeight: "28px",
+ }}
+ >
+ {title}
+ </Heading>
+ <Text
+ style={{
+ margin: 0,
+ color: "#6B7280",
+ fontSize: 14,
+ lineHeight: "24px",
+ }}
+ >
+ {description}
+ </Text>
+ </Column>
+ </Row>
+ </Section>
+ );
+ })}
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/ListItem.tsx b/packages/react-email/src/components/ListItem.tsx
new file mode 100644
index 000000000..e70b88831
--- /dev/null
+++ b/packages/react-email/src/components/ListItem.tsx
@@ -0,0 +1,14 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailListItem = defineComponent({
+ name: "EmailListItem",
+ props: z.object({
+ title: z.string(),
+ description: z.string(),
+ }),
+ description: "Data-only list item with title and description. Used as a child inside EmailList.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/Markdown.tsx b/packages/react-email/src/components/Markdown.tsx
new file mode 100644
index 000000000..0dcfff8b5
--- /dev/null
+++ b/packages/react-email/src/components/Markdown.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Markdown } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailMarkdown = defineComponent({
+ name: "EmailMarkdown",
+ props: z.object({
+ content: z.string(),
+ }),
+ description:
+ "Renders markdown content as styled email HTML. Supports headings, bold, italic, links, lists, and code.",
+ component: ({ props }) => (
+ <Markdown
+ markdownCustomStyles={{
+ p: { color: "#374151", fontSize: "16px", lineHeight: "24px" },
+ link: { color: "#5F51E8", textDecoration: "underline" },
+ h1: { color: "#1a1a1a", fontSize: "28px" },
+ h2: { color: "#1a1a1a", fontSize: "22px" },
+ h3: { color: "#1a1a1a", fontSize: "18px" },
+ }}
+ >
+ {props.content as string}
+ </Markdown>
+ ),
+});
diff --git a/packages/react-email/src/components/NavLink.tsx b/packages/react-email/src/components/NavLink.tsx
new file mode 100644
index 000000000..9861cc75c
--- /dev/null
+++ b/packages/react-email/src/components/NavLink.tsx
@@ -0,0 +1,14 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailNavLink = defineComponent({
+ name: "EmailNavLink",
+ props: z.object({
+ text: z.string(),
+ href: z.string(),
+ }),
+ description: "Navigation link item for email headers.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/NumberedSteps.tsx b/packages/react-email/src/components/NumberedSteps.tsx
new file mode 100644
index 000000000..cab76ce56
--- /dev/null
+++ b/packages/react-email/src/components/NumberedSteps.tsx
@@ -0,0 +1,106 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Hr, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailStepItem } from "./StepItem";
+
+export const EmailNumberedSteps = defineComponent({
+ name: "EmailNumberedSteps",
+ props: z.object({
+ title: z.string(),
+ description: z.string(),
+ steps: z.array(EmailStepItem.ref),
+ }),
+ description:
+ "Numbered steps list with header title, description, and sequential step items. Each step shows a numbered badge, title, and description.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const steps = (props.steps ?? []) as any[];
+
+ return (
+ <Section style={{ marginTop: 16 }}>
+ <Section style={{ paddingBottom: 24 }}>
+ <Text
+ style={{
+ margin: 0,
+ fontWeight: 600,
+ fontSize: 24,
+ color: "#111827",
+ lineHeight: "32px",
+ }}
+ >
+ {props.title as string}
+ </Text>
+ <Text
+ style={{
+ marginTop: 8,
+ fontSize: 16,
+ color: "#6B7280",
+ lineHeight: "24px",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ </Section>
+ {steps.map((step, index) => (
+ <Section key={index}>
+ <Hr
+ style={{
+ border: "1px solid #D1D5DB",
+ margin: 0,
+ width: "100%",
+ }}
+ />
+ <Section style={{ paddingTop: 24, paddingBottom: 24 }}>
+ <Row>
+ <Column width="48" style={{ width: 48, paddingRight: 12, verticalAlign: "top" }}>
+ <div
+ style={{
+ backgroundColor: "#C7D2FE",
+ borderRadius: "9999px",
+ color: "#4F46E5",
+ fontWeight: 700,
+ height: 36,
+ width: 36,
+ fontSize: 14,
+ lineHeight: "36px",
+ textAlign: "center" as const,
+ display: "inline-block",
+ }}
+ >
+ {index + 1}
+ </div>
+ </Column>
+ <Column width="100%" style={{ width: "100%" }}>
+ <Text
+ style={{
+ margin: 0,
+ fontWeight: 600,
+ fontSize: 20,
+ lineHeight: "28px",
+ color: "#111827",
+ }}
+ >
+ {String(step?.props?.title ?? "")}
+ </Text>
+ <Text
+ style={{
+ margin: 0,
+ paddingTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {String(step?.props?.description ?? "")}
+ </Text>
+ </Column>
+ </Row>
+ </Section>
+ </Section>
+ ))}
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/PricingCard.tsx b/packages/react-email/src/components/PricingCard.tsx
new file mode 100644
index 000000000..207bf52f3
--- /dev/null
+++ b/packages/react-email/src/components/PricingCard.tsx
@@ -0,0 +1,156 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button, Hr, Text } from "@react-email/components";
+import { z } from "zod";
+import { EmailPricingFeature } from "./PricingFeature";
+
+export const EmailPricingCard = defineComponent({
+ name: "EmailPricingCard",
+ props: z.object({
+ badge: z.string().optional(),
+ price: z.string(),
+ period: z.string().optional(),
+ description: z.string(),
+ features: z.array(EmailPricingFeature.ref),
+ buttonLabel: z.string(),
+ buttonHref: z.string(),
+ buttonColor: z.string().optional(),
+ note: z.string().optional(),
+ subNote: z.string().optional(),
+ }),
+ description:
+ "Pricing card with badge, price, description, feature list, CTA button, and optional note. Great for upgrade and promotional emails.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const features = (props.features ?? []) as any[];
+ const bg = (props.buttonColor as string) ?? "#4F46E5";
+ const period = (props.period as string) ?? "/ month";
+
+ return (
+ <div
+ style={{
+ backgroundColor: "#ffffff",
+ borderColor: "#D1D5DB",
+ borderRadius: "12px",
+ borderStyle: "solid",
+ borderWidth: "1px",
+ color: "#4B5563",
+ padding: "28px",
+ textAlign: "left",
+ width: "100%",
+ boxSizing: "border-box",
+ }}
+ >
+ {props.badge && (
+ <Text
+ style={{
+ color: "#4F46E5",
+ fontSize: "12px",
+ fontWeight: 600,
+ letterSpacing: "0.025em",
+ lineHeight: "20px",
+ marginBottom: "16px",
+ marginTop: "0px",
+ textTransform: "uppercase" as const,
+ }}
+ >
+ {props.badge as string}
+ </Text>
+ )}
+ <Text
+ style={{
+ fontSize: "30px",
+ fontWeight: 700,
+ lineHeight: "36px",
+ marginBottom: "12px",
+ marginTop: "0px",
+ }}
+ >
+ <span style={{ color: "#101828" }}>{props.price as string}</span>{" "}
+ <span style={{ fontSize: "16px", fontWeight: 500, lineHeight: "20px" }}>{period}</span>
+ </Text>
+ <Text
+ style={{
+ color: "#374151",
+ fontSize: "14px",
+ lineHeight: "20px",
+ marginBottom: "24px",
+ marginTop: "16px",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ <ul
+ style={{
+ color: "#6B7280",
+ fontSize: "14px",
+ lineHeight: "24px",
+ marginBottom: "32px",
+ paddingLeft: "14px",
+ }}
+ >
+ {features.map((feat, i) => (
+ <li key={i} style={{ marginBottom: "12px", position: "relative" }}>
+ <span style={{ position: "relative" }}>{String(feat?.props?.text ?? "")}</span>
+ </li>
+ ))}
+ </ul>
+ <Button
+ href={props.buttonHref as string}
+ style={{
+ backgroundColor: bg,
+ borderRadius: "8px",
+ boxSizing: "border-box",
+ color: "#ffffff",
+ display: "inline-block",
+ fontSize: "16px",
+ fontWeight: 700,
+ letterSpacing: "0.025em",
+ lineHeight: "24px",
+ marginBottom: "24px",
+ maxWidth: "100%",
+ padding: "14px",
+ textAlign: "center",
+ width: "100%",
+ }}
+ >
+ {props.buttonLabel as string}
+ </Button>
+ {(props.note || props.subNote) && (
+ <>
+ <Hr />
+ {props.note && (
+ <Text
+ style={{
+ color: "#6B7280",
+ fontSize: "12px",
+ fontStyle: "italic",
+ lineHeight: "16px",
+ marginBottom: "6px",
+ marginTop: "24px",
+ textAlign: "center",
+ }}
+ >
+ {props.note as string}
+ </Text>
+ )}
+ {props.subNote && (
+ <Text
+ style={{
+ color: "#6B7280",
+ fontSize: "12px",
+ lineHeight: "16px",
+ margin: "0px",
+ textAlign: "center",
+ }}
+ >
+ {props.subNote as string}
+ </Text>
+ )}
+ </>
+ )}
+ </div>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/PricingFeature.tsx b/packages/react-email/src/components/PricingFeature.tsx
new file mode 100644
index 000000000..30bf3d003
--- /dev/null
+++ b/packages/react-email/src/components/PricingFeature.tsx
@@ -0,0 +1,13 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailPricingFeature = defineComponent({
+ name: "EmailPricingFeature",
+ props: z.object({
+ text: z.string(),
+ }),
+ description: "Single pricing feature line item. Used inside EmailPricingCard.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/ProductCard.tsx b/packages/react-email/src/components/ProductCard.tsx
new file mode 100644
index 000000000..6643e2e0e
--- /dev/null
+++ b/packages/react-email/src/components/ProductCard.tsx
@@ -0,0 +1,97 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Button, Heading, Img, Section, Text } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailProductCard = defineComponent({
+ name: "EmailProductCard",
+ props: z.object({
+ imageSrc: z.string(),
+ imageAlt: z.string(),
+ category: z.string().optional(),
+ title: z.string(),
+ description: z.string(),
+ price: z.string(),
+ buttonLabel: z.string(),
+ buttonHref: z.string(),
+ buttonColor: z.string().optional(),
+ }),
+ description:
+ "Product showcase card with hero image, optional category, title, description, price, and buy button.",
+ component: ({ props }) => {
+ const bg = (props.buttonColor as string) ?? "#4F46E5";
+ return (
+ <Section style={{ marginTop: 16, marginBottom: 16 }}>
+ <Img
+ alt={props.imageAlt as string}
+ height="320"
+ src={props.imageSrc as string}
+ style={{ width: "100%", borderRadius: 12, objectFit: "cover" }}
+ />
+ <Section style={{ marginTop: 32, textAlign: "center" }}>
+ {props.category && (
+ <Text
+ style={{
+ marginTop: 16,
+ fontSize: 18,
+ lineHeight: "28px",
+ fontWeight: 600,
+ color: "#4F46E5",
+ }}
+ >
+ {props.category as string}
+ </Text>
+ )}
+ <Heading
+ as="h1"
+ style={{
+ fontSize: 36,
+ lineHeight: "40px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.title as string}
+ </Heading>
+ <Text
+ style={{
+ marginTop: 8,
+ fontSize: 16,
+ lineHeight: "24px",
+ color: "#6B7280",
+ }}
+ >
+ {props.description as string}
+ </Text>
+ <Text
+ style={{
+ fontSize: 16,
+ lineHeight: "24px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.price as string}
+ </Text>
+ <Button
+ href={props.buttonHref as string}
+ style={{
+ marginTop: 16,
+ borderRadius: 8,
+ backgroundColor: bg,
+ paddingLeft: 24,
+ paddingRight: 24,
+ paddingTop: 12,
+ paddingBottom: 12,
+ fontWeight: 600,
+ color: "#ffffff",
+ }}
+ >
+ {props.buttonLabel as string}
+ </Button>
+ </Section>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Section.tsx b/packages/react-email/src/components/Section.tsx
new file mode 100644
index 000000000..2e9f906b0
--- /dev/null
+++ b/packages/react-email/src/components/Section.tsx
@@ -0,0 +1,18 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Section } from "@react-email/components";
+import { z } from "zod";
+import { EmailLeafChildUnion } from "../unions";
+
+export const EmailSection = defineComponent({
+ name: "EmailSection",
+ props: z.object({
+ children: z.array(EmailLeafChildUnion),
+ }),
+ description:
+ "Groups email content into a section. Use to organize header, body, and footer areas.",
+ component: ({ props, renderNode }) => (
+ <Section style={{ margin: "0 0 24px 0" }}>{renderNode(props.children)}</Section>
+ ),
+});
diff --git a/packages/react-email/src/components/SocialIcon.tsx b/packages/react-email/src/components/SocialIcon.tsx
new file mode 100644
index 000000000..d54d2de67
--- /dev/null
+++ b/packages/react-email/src/components/SocialIcon.tsx
@@ -0,0 +1,15 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailSocialIcon = defineComponent({
+ name: "EmailSocialIcon",
+ props: z.object({
+ src: z.string(),
+ alt: z.string(),
+ href: z.string(),
+ }),
+ description: "Social media icon link for email headers. src should be a square icon image URL.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/StatItem.tsx b/packages/react-email/src/components/StatItem.tsx
new file mode 100644
index 000000000..7d8c42512
--- /dev/null
+++ b/packages/react-email/src/components/StatItem.tsx
@@ -0,0 +1,14 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailStatItem = defineComponent({
+ name: "EmailStatItem",
+ props: z.object({
+ value: z.string(),
+ label: z.string(),
+ }),
+ description: "Single stat with a value and label. Used inside EmailStats.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/Stats.tsx b/packages/react-email/src/components/Stats.tsx
new file mode 100644
index 000000000..06cb53cd4
--- /dev/null
+++ b/packages/react-email/src/components/Stats.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Row } from "@react-email/components";
+import { z } from "zod";
+import { EmailStatItem } from "./StatItem";
+
+export const EmailStats = defineComponent({
+ name: "EmailStats",
+ props: z.object({
+ items: z.array(EmailStatItem.ref),
+ }),
+ description:
+ "Horizontal stats row displaying key metrics. Each stat has a large value and a label below it.",
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const items = (props.items ?? []) as any[];
+
+ return (
+ <Row>
+ {items.map((item, i) => (
+ <Column key={i}>
+ <p
+ style={{
+ margin: 0,
+ textAlign: "left",
+ fontSize: 18,
+ lineHeight: "24px",
+ fontWeight: 700,
+ letterSpacing: "-0.025em",
+ color: "#111827",
+ fontVariantNumeric: "tabular-nums",
+ }}
+ >
+ {String(item?.props?.value ?? "")}
+ </p>
+ <p
+ style={{
+ margin: 0,
+ textAlign: "left",
+ fontSize: 12,
+ lineHeight: "18px",
+ color: "#6B7280",
+ }}
+ >
+ {String(item?.props?.label ?? "")}
+ </p>
+ </Column>
+ ))}
+ </Row>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/StepItem.tsx b/packages/react-email/src/components/StepItem.tsx
new file mode 100644
index 000000000..45dd36f9a
--- /dev/null
+++ b/packages/react-email/src/components/StepItem.tsx
@@ -0,0 +1,14 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+
+export const EmailStepItem = defineComponent({
+ name: "EmailStepItem",
+ props: z.object({
+ title: z.string(),
+ description: z.string(),
+ }),
+ description: "Single numbered step with title and description. Used inside EmailNumberedSteps.",
+ component: () => null,
+});
diff --git a/packages/react-email/src/components/SurveyRating.tsx b/packages/react-email/src/components/SurveyRating.tsx
new file mode 100644
index 000000000..06b549146
--- /dev/null
+++ b/packages/react-email/src/components/SurveyRating.tsx
@@ -0,0 +1,86 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Heading, Row, Section, Text } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailSurveyRating = defineComponent({
+ name: "EmailSurveyRating",
+ props: z.object({
+ question: z.string(),
+ description: z.string().optional(),
+ buttonColor: z.string().optional(),
+ }),
+ description:
+ "Rating survey section with a question and 1-5 numbered buttons. Great for feedback and NPS emails.",
+ component: ({ props }) => {
+ const bg = (props.buttonColor as string) ?? "#4F46E5";
+
+ return (
+ <Section style={{ textAlign: "center", paddingTop: 16, paddingBottom: 16 }}>
+ <Text
+ style={{
+ marginTop: 8,
+ marginBottom: 8,
+ fontSize: 18,
+ lineHeight: "28px",
+ fontWeight: 600,
+ color: "#4F46E5",
+ }}
+ >
+ Your opinion matters
+ </Text>
+ <Heading
+ as="h1"
+ style={{
+ margin: "0px",
+ marginTop: 8,
+ fontSize: 30,
+ lineHeight: "36px",
+ fontWeight: 600,
+ color: "#111827",
+ }}
+ >
+ {props.question as string}
+ </Heading>
+ {props.description && (
+ <Text style={{ fontSize: 16, lineHeight: "24px", color: "#374151" }}>
+ {props.description as string}
+ </Text>
+ )}
+ <Row>
+ <Column align="center">
+ <table>
+ <tbody>
+ <tr>
+ {[1, 2, 3, 4, 5].map((number) => (
+ <td align="center" key={number} style={{ padding: 4 }}>
+ <a
+ href={`#rating-${number}`}
+ style={{
+ display: "inline-block",
+ height: 40,
+ width: 40,
+ borderRadius: 8,
+ border: `1px solid ${bg}`,
+ fontSize: 16,
+ fontWeight: 600,
+ color: bg,
+ textDecoration: "none",
+ lineHeight: "40px",
+ textAlign: "center",
+ }}
+ >
+ {number}
+ </a>
+ </td>
+ ))}
+ </tr>
+ </tbody>
+ </table>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Template.tsx b/packages/react-email/src/components/Template.tsx
new file mode 100644
index 000000000..102eb018a
--- /dev/null
+++ b/packages/react-email/src/components/Template.tsx
@@ -0,0 +1,50 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { z } from "zod";
+import { EmailLeafChildUnion } from "../unions";
+import { EmailColumn } from "./Column";
+import { EmailColumns } from "./Columns";
+import { EmailFooterCentered } from "./FooterCentered";
+import { EmailFooterTwoColumn } from "./FooterTwoColumn";
+import { EmailHeaderCenteredNav } from "./HeaderCenteredNav";
+import { EmailHeaderSideNav } from "./HeaderSideNav";
+import { EmailHeaderSocial } from "./HeaderSocial";
+import { EmailSection } from "./Section";
+
+const EmailTemplateChildUnion = z.union([
+ ...EmailLeafChildUnion.options,
+ EmailSection.ref,
+ EmailColumns.ref,
+ EmailColumn.ref,
+ EmailHeaderSideNav.ref,
+ EmailHeaderCenteredNav.ref,
+ EmailHeaderSocial.ref,
+ EmailFooterCentered.ref,
+ EmailFooterTwoColumn.ref,
+]);
+
+export const EmailTemplate = defineComponent({
+ name: "EmailTemplate",
+ props: z.object({
+ subject: z.string(),
+ previewText: z.string().optional(),
+ children: z.array(EmailTemplateChildUnion),
+ }),
+ description:
+ "Root email template. Renders a live email preview with Copy HTML export. Always provide a subject line.",
+ component: function EmailTemplateView({ props, renderNode }) {
+ return (
+ <div
+ style={{
+ padding: "32px 40px",
+ backgroundColor: "#fff",
+ maxWidth: "600px",
+ margin: "0 auto",
+ }}
+ >
+ {renderNode(props.children)}
+ </div>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Testimonial.tsx b/packages/react-email/src/components/Testimonial.tsx
new file mode 100644
index 000000000..846eeb9b9
--- /dev/null
+++ b/packages/react-email/src/components/Testimonial.tsx
@@ -0,0 +1,84 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Column, Img, Row, Section } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailTestimonial = defineComponent({
+ name: "EmailTestimonial",
+ props: z.object({
+ quote: z.string(),
+ avatarSrc: z.string(),
+ avatarAlt: z.string(),
+ name: z.string(),
+ role: z.string(),
+ }),
+ description:
+ "Testimonial quote with avatar, name, and role. Centered layout for social proof in emails.",
+ component: ({ props }) => {
+ return (
+ <Section
+ style={{
+ textAlign: "center",
+ fontSize: 14,
+ lineHeight: "20px",
+ color: "#4B5563",
+ }}
+ >
+ <p
+ style={{
+ margin: 0,
+ fontSize: 16,
+ lineHeight: "24px",
+ fontWeight: 300,
+ color: "#1F2937",
+ }}
+ >
+ {props.quote as string}
+ </p>
+ <Row style={{ marginTop: "32px" }} align="center">
+ <Column valign="middle">
+ <div
+ style={{
+ height: 32,
+ width: 32,
+ borderRadius: "9999px",
+ overflow: "hidden",
+ backgroundColor: "#4B5563",
+ }}
+ >
+ <Img
+ src={props.avatarSrc as string}
+ width={32}
+ height={32}
+ alt={props.avatarAlt as string}
+ style={{ height: "100%", width: "100%", objectFit: "cover" }}
+ />
+ </div>
+ </Column>
+ <Column valign="middle">
+ <p
+ style={{
+ margin: 0,
+ marginLeft: 12,
+ fontSize: 14,
+ lineHeight: "20px",
+ fontWeight: 600,
+ color: "#111827",
+ marginRight: 8,
+ }}
+ >
+ {props.name as string}
+ </p>
+ </Column>
+ <Column valign="middle">
+ <span style={{ fontSize: 14, lineHeight: "20px", marginRight: 8 }}>&bull;</span>
+ </Column>
+ <Column valign="middle">
+ <p style={{ margin: 0, fontSize: 14, lineHeight: "20px" }}>{props.role as string}</p>
+ </Column>
+ </Row>
+ </Section>
+ );
+ },
+});
diff --git a/packages/react-email/src/components/Text.tsx b/packages/react-email/src/components/Text.tsx
new file mode 100644
index 000000000..4eb4c3301
--- /dev/null
+++ b/packages/react-email/src/components/Text.tsx
@@ -0,0 +1,26 @@
+"use client";
+
+import { defineComponent } from "@openuidev/react-lang";
+import { Text } from "@react-email/components";
+import { z } from "zod";
+
+export const EmailText = defineComponent({
+ name: "EmailText",
+ props: z.object({
+ text: z.string(),
+ }),
+ description: "Email text paragraph for body content.",
+ component: ({ props }) => (
+ <Text
+ style={{
+ color: "#374151",
+ fontSize: "16px",
+ lineHeight: "24px",
+ margin: "0 0 16px 0",
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
+ }}
+ >
+ {props.text as string}
+ </Text>
+ ),
+});
diff --git a/packages/react-email/src/index.ts b/packages/react-email/src/index.ts
new file mode 100644
index 000000000..204566d78
--- /dev/null
+++ b/packages/react-email/src/index.ts
@@ -0,0 +1 @@
+export { emailLibrary, emailPromptOptions } from "./library";
diff --git a/packages/react-email/src/library.ts b/packages/react-email/src/library.ts
new file mode 100644
index 000000000..bc73998c9
--- /dev/null
+++ b/packages/react-email/src/library.ts
@@ -0,0 +1,494 @@
+import type { ComponentGroup, PromptOptions } from "@openuidev/react-lang";
+import { createLibrary } from "@openuidev/react-lang";
+
+// ── Email components ──
+
+import { EmailArticle } from "./components/Article";
+import { EmailAvatar } from "./components/Avatar";
+import { EmailAvatarGroup } from "./components/AvatarGroup";
+import { EmailAvatarWithText } from "./components/AvatarWithText";
+import { EmailBentoGrid } from "./components/BentoGrid";
+import { EmailBentoItem } from "./components/BentoItem";
+import { EmailButton } from "./components/Button";
+import { EmailCheckoutItem } from "./components/CheckoutItem";
+import { EmailCheckoutTable } from "./components/CheckoutTable";
+import { EmailCodeBlock } from "./components/CodeBlock";
+import { EmailCodeInline } from "./components/CodeInline";
+import { EmailColumn } from "./components/Column";
+import { EmailColumns } from "./components/Columns";
+import { EmailCustomerReview } from "./components/CustomerReview";
+import { EmailDivider } from "./components/Divider";
+import { EmailFeatureGrid } from "./components/FeatureGrid";
+import { EmailFeatureItem } from "./components/FeatureItem";
+import { EmailFeatureList } from "./components/FeatureList";
+import { EmailFooterCentered } from "./components/FooterCentered";
+import { EmailFooterTwoColumn } from "./components/FooterTwoColumn";
+import { EmailHeaderCenteredNav } from "./components/HeaderCenteredNav";
+import { EmailHeaderSideNav } from "./components/HeaderSideNav";
+import { EmailHeaderSocial } from "./components/HeaderSocial";
+import { EmailHeading } from "./components/Heading";
+import { EmailImage } from "./components/Image";
+import { EmailImageGrid } from "./components/ImageGrid";
+import { EmailLink } from "./components/Link";
+import { EmailList } from "./components/List";
+import { EmailListItem } from "./components/ListItem";
+import { EmailMarkdown } from "./components/Markdown";
+import { EmailNavLink } from "./components/NavLink";
+import { EmailNumberedSteps } from "./components/NumberedSteps";
+import { EmailPricingCard } from "./components/PricingCard";
+import { EmailPricingFeature } from "./components/PricingFeature";
+import { EmailProductCard } from "./components/ProductCard";
+import { EmailSection } from "./components/Section";
+import { EmailSocialIcon } from "./components/SocialIcon";
+import { EmailStatItem } from "./components/StatItem";
+import { EmailStats } from "./components/Stats";
+import { EmailStepItem } from "./components/StepItem";
+import { EmailSurveyRating } from "./components/SurveyRating";
+import { EmailTemplate } from "./components/Template";
+import { EmailTestimonial } from "./components/Testimonial";
+import { EmailText } from "./components/Text";
+
+// ── Component groups (email only) ──
+
+export const emailComponentGroups: ComponentGroup[] = [
+ {
+ name: "Email Structure",
+ components: ["EmailTemplate", "EmailSection", "EmailColumns", "EmailColumn"],
+ notes: [
+ "- EmailTemplate is the root email wrapper. Always use it for email content.",
+ "- Use EmailSection to group related content (e.g. header area, body, footer).",
+ "- Use EmailColumns + EmailColumn for multi-column layouts (e.g. two features side by side).",
+ ],
+ },
+ {
+ name: "Email Headers",
+ components: [
+ "EmailHeaderSideNav",
+ "EmailHeaderCenteredNav",
+ "EmailHeaderSocial",
+ "EmailNavLink",
+ "EmailSocialIcon",
+ ],
+ notes: [
+ "- EmailHeaderSideNav: Logo on the left, text navigation links on the right. Use EmailNavLink for each link.",
+ "- EmailHeaderCenteredNav: Logo centered on top, text navigation links centered below. Use EmailNavLink for each link.",
+ "- EmailHeaderSocial: Logo on the left, social media icon links on the right. Use EmailSocialIcon for each icon.",
+ "- Place a header as the FIRST child of EmailTemplate for a professional branded look.",
+ "- Always follow the header with an EmailDivider to separate it from the body content.",
+ ],
+ },
+ {
+ name: "Email Footers",
+ components: ["EmailFooterCentered", "EmailFooterTwoColumn"],
+ notes: [
+ "- EmailFooterCentered: Centered footer with logo, company name, tagline, social icons, address, and contact info.",
+ "- EmailFooterTwoColumn: Two-column footer with logo and company info on the left, social icons and address on the right.",
+ "- Both footer components accept EmailSocialIcon items for social media icons.",
+ "- Place a footer as the LAST child of EmailTemplate, after an EmailDivider.",
+ ],
+ },
+ {
+ name: "Email Content",
+ components: [
+ "EmailHeading",
+ "EmailText",
+ "EmailButton",
+ "EmailImage",
+ "EmailDivider",
+ "EmailLink",
+ "EmailCodeBlock",
+ "EmailCodeInline",
+ "EmailMarkdown",
+ ],
+ notes: [
+ "- EmailHeading level 1 for main title, level 2 for section headers.",
+ "- EmailButton always needs an href URL.",
+ "- EmailImage should use real, publicly accessible image URLs.",
+ "- EmailDivider takes no arguments: EmailDivider()",
+ "- EmailCodeBlock for multi-line code snippets. Optionally set language (e.g. 'javascript', 'python').",
+ "- EmailCodeInline for inline code within text (e.g. variable names, commands).",
+ "- EmailMarkdown for rendering markdown content (headings, bold, italic, links, lists).",
+ ],
+ },
+ {
+ name: "Email Articles & Products",
+ components: ["EmailArticle", "EmailProductCard"],
+ notes: [
+ "- EmailArticle: Hero image + category + title + description + CTA button. Great for blog posts and newsletters.",
+ "- EmailProductCard: Hero image + category + title + description + price + buy button. Great for product showcases.",
+ "- Both support an optional buttonColor prop for CTA button customization.",
+ ],
+ },
+ {
+ name: "Email Features & Steps",
+ components: [
+ "EmailFeatureItem",
+ "EmailFeatureGrid",
+ "EmailFeatureList",
+ "EmailStepItem",
+ "EmailNumberedSteps",
+ ],
+ notes: [
+ "- EmailFeatureItem: Child component with iconSrc, iconAlt, title, description. Used inside EmailFeatureGrid or EmailFeatureList.",
+ "- EmailFeatureGrid: 2x2 grid of features with header title and description. Takes EmailFeatureItem items.",
+ "- EmailFeatureList: Vertical list of features separated by dividers. Takes EmailFeatureItem items.",
+ "- EmailStepItem: Child component with title and description. Used inside EmailNumberedSteps.",
+ "- EmailNumberedSteps: Numbered steps list with auto-numbered badges. Takes EmailStepItem items.",
+ "- For icon URLs, use https://picsum.photos/seed/KEYWORD/48/48 or similar.",
+ ],
+ },
+ {
+ name: "Email Commerce",
+ components: [
+ "EmailCheckoutItem",
+ "EmailCheckoutTable",
+ "EmailPricingFeature",
+ "EmailPricingCard",
+ ],
+ notes: [
+ "- EmailCheckoutItem: Cart item with optional image, name, quantity, price. Used inside EmailCheckoutTable.",
+ "- EmailCheckoutTable: Cart table with items and checkout button. Great for abandoned cart and order summary emails.",
+ "- EmailPricingFeature: Single feature line item text. Used inside EmailPricingCard.",
+ "- EmailPricingCard: Pricing card with badge, price, period, description, features list, CTA button, and optional note.",
+ ],
+ },
+ {
+ name: "Email Social Proof & Surveys",
+ components: ["EmailTestimonial", "EmailSurveyRating", "EmailStatItem", "EmailStats"],
+ notes: [
+ "- EmailTestimonial: Centered testimonial quote with avatar, name, and role.",
+ "- EmailSurveyRating: Rating survey with question and 1-5 numbered buttons. Great for feedback/NPS emails.",
+ "- EmailStatItem: Child component with value and label. Used inside EmailStats.",
+ "- EmailStats: Horizontal row of key metrics/stats.",
+ ],
+ },
+ {
+ name: "Email Image Layouts",
+ components: ["EmailImageGrid"],
+ notes: [
+ "- EmailImageGrid: 2x2 image grid with optional title and description. Pass up to 4 EmailImage items.",
+ "- Great for product galleries, portfolios, and visual showcases.",
+ ],
+ },
+ {
+ name: "Email Avatars",
+ components: ["EmailAvatar", "EmailAvatarGroup", "EmailAvatarWithText"],
+ notes: [
+ "- EmailAvatar: Single avatar image. Supports circular (rounded='full') or rounded-square (rounded='md') shapes, and configurable size.",
+ "- EmailAvatarGroup: Overlapping stacked avatars. Pass EmailAvatar items. Great for showing team members or participants.",
+ "- EmailAvatarWithText: Avatar with name and role text beside it. Optionally wraps in a link. Great for author attribution.",
+ ],
+ },
+ {
+ name: "Email Lists",
+ components: ["EmailListItem", "EmailList"],
+ notes: [
+ "- EmailListItem: Data-only component with title and description. Used as a child inside EmailList.",
+ "- EmailList: Numbered list with circular badges. Pass EmailListItem children. Great for top-N lists, how-it-works, and feature lists.",
+ ],
+ },
+ {
+ name: "Email Reviews",
+ components: ["EmailCustomerReview"],
+ notes: [
+ "- EmailCustomerReview: Star rating distribution with bars and percentages. Shows total review count and optional CTA button.",
+ "- Provide rating counts for each star level (rating1 through rating5) and totalReviews.",
+ ],
+ },
+ {
+ name: "Email Marketing",
+ components: ["EmailBentoItem", "EmailBentoGrid"],
+ notes: [
+ "- EmailBentoItem: Data-only component with imageSrc, imageAlt, title, description. Used inside EmailBentoGrid.",
+ "- EmailBentoGrid: Bento-style layout with a dark hero section on top and product cards below. Pass EmailBentoItem children.",
+ "- Great for product showcase and marketing emails.",
+ ],
+ },
+];
+
+// ── Examples (email only, Examples 1-10) ──
+
+export const emailExamples: string[] = [
+ `Example 1 — Welcome email:
+root = EmailTemplate("Welcome to Acme!", "You're in! Here's how to get started.", [heading, intro, btn, divider, footer])
+heading = EmailHeading("Welcome aboard!", 1)
+intro = EmailText("Thanks for signing up for Acme. We're thrilled to have you on board. Here's everything you need to get started.")
+btn = EmailButton("Get Started", "https://example.com/start", "#5F51E8")
+divider = EmailDivider()
+footer = EmailText("If you have any questions, reply to this email. We're here to help.")`,
+
+ `Example 2 — Newsletter with header and footer:
+root = EmailTemplate("Acme Weekly", "This week: new features and tips", [header, divider1, section1, divider2, section2, divider3, footer])
+header = EmailHeaderSideNav("https://picsum.photos/seed/acme-logo/150/42", "Acme", 42, [nav1, nav2, nav3])
+nav1 = EmailNavLink("About", "https://example.com/about")
+nav2 = EmailNavLink("Blog", "https://example.com/blog")
+nav3 = EmailNavLink("Docs", "https://example.com/docs")
+divider1 = EmailDivider()
+section1 = EmailSection([s1title, s1text, s1btn])
+s1title = EmailHeading("New Feature: Dark Mode", 2)
+s1text = EmailText("We just launched dark mode across all platforms. Your eyes will thank you.")
+s1btn = EmailButton("Try It Now", "https://example.com/dark-mode", "#1a1a2e")
+divider2 = EmailDivider()
+section2 = EmailSection([s2title, s2text])
+s2title = EmailHeading("Tip of the Week", 2)
+s2text = EmailText("Use keyboard shortcuts to navigate 3x faster.")
+divider3 = EmailDivider()
+footer = EmailFooterCentered("https://picsum.photos/seed/acme-icon/42/42", "Acme", "Acme Corporation", "Think different", "123 Main Street, Anytown, CA 12345", "[email protected]", [fi1, fi2, fi3])
+fi1 = EmailSocialIcon("https://react.email/static/facebook-logo.png", "Facebook", "https://facebook.com/acme")
+fi2 = EmailSocialIcon("https://react.email/static/x-logo.png", "X", "https://x.com/acme")
+fi3 = EmailSocialIcon("https://react.email/static/instagram-logo.png", "Instagram", "https://instagram.com/acme")`,
+
+ `Example 3 — Order confirmation with columns:
+root = EmailTemplate("Order Confirmed #12345", "Your order has been placed!", [heading, thanks, divider1, cols, divider2, total, btn, divider3, footer])
+heading = EmailHeading("Order Confirmed", 1)
+thanks = EmailText("Thank you for your purchase! Here's a summary of your order.")
+divider1 = EmailDivider()
+cols = EmailColumns([col1, col2])
+col1 = EmailColumn([itemTitle, itemDesc])
+col2 = EmailColumn([priceTitle, priceVal])
+itemTitle = EmailHeading("Item", 2)
+itemDesc = EmailText("Premium Plan - Annual")
+priceTitle = EmailHeading("Price", 2)
+priceVal = EmailText("$99.00/year")
+divider2 = EmailDivider()
+total = EmailText("Total: $99.00")
+btn = EmailButton("View Order", "https://example.com/orders/12345", "#16a34a")
+divider3 = EmailDivider()
+footer = EmailText("Need help? Contact us at [email protected]")`,
+
+ `Example 4 — Developer onboarding with code:
+root = EmailTemplate("Getting Started with Acme API", "Your API key is ready", [heading, intro, section1, divider, section2, divider2, footer])
+heading = EmailHeading("Welcome to the Acme API", 1)
+intro = EmailMarkdown("You're all set! Below you'll find everything you need to **get started** with our API.")
+section1 = EmailSection([s1title, s1text, codeblock])
+s1title = EmailHeading("Quick Start", 2)
+s1text = EmailText("Install the SDK and make your first request:")
+codeblock = EmailCodeBlock("npm install @acme/sdk\\n\\nimport { Acme } from '@acme/sdk';\\nconst client = new Acme({ apiKey: 'your-key' });\\nconst res = await client.ping();", "javascript")
+divider = EmailDivider()
+section2 = EmailSection([s2title, s2text])
+s2title = EmailHeading("Need Help?", 2)
+s2text = EmailMarkdown("Check our [documentation](https://docs.example.com) or reply to this email.")
+divider2 = EmailDivider()
+footer = EmailText("Happy coding!")`,
+
+ `Example 5 — Password reset email:
+root = EmailTemplate("Reset your password", "Someone requested a password change", [logo, heading, text1, btn, text2, divider, linkText, divider2, footer])
+logo = EmailImage("https://picsum.photos/seed/app-logo/100/30", "App", 100)
+heading = EmailHeading("Reset your password", 1)
+text1 = EmailText("Someone recently requested a password change for your account. If this was you, click below:")
+btn = EmailButton("Reset Password", "https://example.com/reset?token=abc123", "#0061fe")
+text2 = EmailText("Or copy and paste this link:")
+divider = EmailDivider()
+linkText = EmailLink("https://example.com/reset?token=abc123", "https://example.com/reset?token=abc123")
+divider2 = EmailDivider()
+footer = EmailText("If you didn't request this, just ignore this email. This link expires in 24 hours.")`,
+
+ `Example 6 — Promotional sale email:
+root = EmailTemplate("Summer Sale — Up to 50% Off!", "Don't miss our biggest sale", [hero, heading, subhead, divider1, featCols, divider2, ctaBtn, divider3, footer])
+hero = EmailImage("https://picsum.photos/seed/summer-sale/600/250", "Summer Sale Banner", 600)
+heading = EmailHeading("Summer Sale is Here!", 1)
+subhead = EmailText("For a limited time, enjoy up to 50% off on select items.")
+divider1 = EmailDivider()
+featCols = EmailColumns([deal1Col, deal2Col, deal3Col])
+deal1Col = EmailColumn([deal1Img, deal1Name, deal1Price])
+deal2Col = EmailColumn([deal2Img, deal2Name, deal2Price])
+deal3Col = EmailColumn([deal3Img, deal3Name, deal3Price])
+deal1Img = EmailImage("https://picsum.photos/seed/product1/180/180", "Sunglasses", 180)
+deal1Name = EmailText("Designer Sunglasses")
+deal1Price = EmailText("$49.99 (was $99.99)")
+deal2Img = EmailImage("https://picsum.photos/seed/product2/180/180", "Beach Bag", 180)
+deal2Name = EmailText("Canvas Beach Bag")
+deal2Price = EmailText("$29.99 (was $59.99)")
+deal3Img = EmailImage("https://picsum.photos/seed/product3/180/180", "Sandals", 180)
+deal3Name = EmailText("Leather Sandals")
+deal3Price = EmailText("$39.99 (was $79.99)")
+divider2 = EmailDivider()
+ctaBtn = EmailButton("Shop the Sale", "https://example.com/summer-sale", "#e11d48")
+divider3 = EmailDivider()
+footer = EmailText("StyleShop · 500 Fashion Ave · New York, NY 10018")`,
+
+ `Example 7 — Feature showcase with grid and steps:
+root = EmailTemplate("Welcome to Acme!", "Discover what you can do", [heading, intro, divider1, featureGrid, divider2, steps, divider3, footer])
+heading = EmailHeading("Welcome to Acme!", 1)
+intro = EmailText("Here's what you can do with your new account:")
+divider1 = EmailDivider()
+featureGrid = EmailFeatureGrid("Key Features", "Powerful features to help you succeed.", [feat1, feat2, feat3, feat4])
+feat1 = EmailFeatureItem("https://picsum.photos/seed/heart/48/48", "Heart", "Easy to Use", "Get started in minutes.")
+feat2 = EmailFeatureItem("https://picsum.photos/seed/rocket/48/48", "Rocket", "Lightning Fast", "Blazing fast performance.")
+feat3 = EmailFeatureItem("https://picsum.photos/seed/shield/48/48", "Shield", "Secure", "Enterprise-grade security.")
+feat4 = EmailFeatureItem("https://picsum.photos/seed/chart/48/48", "Chart", "Analytics", "Deep data insights.")
+divider2 = EmailDivider()
+steps = EmailNumberedSteps("Getting Started", "Follow these steps:", [step1, step2, step3])
+step1 = EmailStepItem("Create Profile", "Set up your profile with a photo and bio.")
+step2 = EmailStepItem("Connect Tools", "Integrate with Slack, GitHub, and Jira.")
+step3 = EmailStepItem("Invite Team", "Add team members and start collaborating.")
+divider3 = EmailDivider()
+footer = EmailText("Acme, Inc. · San Francisco, CA 94107")`,
+
+ `Example 8 — Abandoned cart email:
+root = EmailTemplate("You left something behind!", "Complete your purchase", [heading, text, checkout, divider, footer])
+heading = EmailHeading("Don't forget your items!", 1)
+text = EmailText("Complete your purchase before these items sell out.")
+checkout = EmailCheckoutTable("Your Cart", [item1, item2], "Complete Purchase", "https://example.com/checkout", "#4F46E5")
+item1 = EmailCheckoutItem("https://picsum.photos/seed/watch/100/100", "Classic Watch", "Classic Watch", 1, "$210.00")
+item2 = EmailCheckoutItem("https://picsum.photos/seed/clock/100/100", "Wall Clock", "Analogue Clock", 2, "$40.00")
+divider = EmailDivider()
+footer = EmailText("Acme Store · 123 Commerce Way · San Francisco, CA 94107")`,
+
+ `Example 9 — Pricing with testimonial and survey:
+root = EmailTemplate("Upgrade to Pro", "Unlock premium features", [heading, text, divider1, pricing, divider2, testimonial, divider3, survey, divider4, footer])
+heading = EmailHeading("Upgrade Your Plan", 1)
+text = EmailText("You've been on the free plan for 30 days. Unlock everything with Pro.")
+divider1 = EmailDivider()
+pricing = EmailPricingCard("Pro", "$12", "/ month", "Everything you need to grow.", [pf1, pf2, pf3], "Upgrade Now", "https://example.com/upgrade", "#4F46E5")
+pf1 = EmailPricingFeature("Unlimited projects")
+pf2 = EmailPricingFeature("Advanced analytics")
+pf3 = EmailPricingFeature("Priority support")
+divider2 = EmailDivider()
+testimonial = EmailTestimonial("Acme Pro transformed our workflow. Can't imagine going back.", "https://picsum.photos/seed/ceo/100/100", "Jane Smith", "Jane Smith", "CEO, TechCorp")
+divider3 = EmailDivider()
+survey = EmailSurveyRating("How would you rate your experience?", "Your feedback helps us improve.", "#4F46E5")
+divider4 = EmailDivider()
+footer = EmailText("Acme, Inc. · San Francisco, CA 94107")`,
+
+ `Example 10 — Stats, gallery, avatars, list, and bento grid:
+root = EmailTemplate("Your Monthly Report", "Key metrics and highlights", [header, divider1, stats, divider2, gallery, divider3, team, divider4, list, divider5, bento, divider6, reviews, divider7, footer])
+header = EmailHeaderCenteredNav("https://picsum.photos/seed/acme/150/42", "Acme", 42, [nav1, nav2])
+nav1 = EmailNavLink("Dashboard", "https://example.com/dashboard")
+nav2 = EmailNavLink("Reports", "https://example.com/reports")
+divider1 = EmailDivider()
+stats = EmailStats([stat1, stat2, stat3])
+stat1 = EmailStatItem("12,847", "Users")
+stat2 = EmailStatItem("94.2%", "Uptime")
+stat3 = EmailStatItem("$48.5K", "Revenue")
+divider2 = EmailDivider()
+gallery = EmailImageGrid("New Products", "Our latest arrivals.", [img1, img2, img3, img4])
+img1 = EmailImage("https://picsum.photos/seed/prod-a/300/288", "Product A")
+img2 = EmailImage("https://picsum.photos/seed/prod-b/300/288", "Product B")
+img3 = EmailImage("https://picsum.photos/seed/prod-c/300/288", "Product C")
+img4 = EmailImage("https://picsum.photos/seed/prod-d/300/288", "Product D")
+divider3 = EmailDivider()
+team = EmailAvatarGroup([av1, av2, av3])
+av1 = EmailAvatar("https://picsum.photos/seed/person1/100/100", "Alice", 44)
+av2 = EmailAvatar("https://picsum.photos/seed/person2/100/100", "Bob", 44)
+av3 = EmailAvatar("https://picsum.photos/seed/person3/100/100", "Carol", 44)
+divider4 = EmailDivider()
+list = EmailList("Top 3 Updates", [li1, li2, li3])
+li1 = EmailListItem("New Dashboard", "Redesigned analytics dashboard with real-time data.")
+li2 = EmailListItem("Mobile App", "Now available on iOS and Android.")
+li3 = EmailListItem("API v2", "Faster, more reliable API with new endpoints.")
+divider5 = EmailDivider()
+bento = EmailBentoGrid("Featured Collection", "Handpicked products for you.", "Shop now", "https://example.com/shop", "https://picsum.photos/seed/hero/400/250", "Collection", [bi1, bi2])
+bi1 = EmailBentoItem("https://picsum.photos/seed/item-x/300/200", "Item X", "Premium Widget", "High-quality craftsmanship.")
+bi2 = EmailBentoItem("https://picsum.photos/seed/item-y/300/200", "Item Y", "Deluxe Gadget", "Next-gen technology.")
+divider6 = EmailDivider()
+reviews = EmailCustomerReview("Product Ratings", 500, 300, 100, 50, 30, 20, "Write a Review", "https://example.com/review", "#4F46E5")
+divider7 = EmailDivider()
+footer = EmailFooterTwoColumn("https://picsum.photos/seed/acme-icon/42/42", "Acme", "Acme Corp", "Innovation first", "123 Main St, CA 12345", "[email protected]", [si1, si2])
+si1 = EmailSocialIcon("https://react.email/static/x-logo.png", "X", "https://x.com/acme")
+si2 = EmailSocialIcon("https://react.email/static/instagram-logo.png", "Instagram", "https://instagram.com/acme")`,
+];
+
+// ── Additional rules (email only) ──
+
+export const emailAdditionalRules: string[] = [
+ "You are an expert email designer using react-email components.",
+ "The 10 supported email types are: Welcome/Onboarding, Newsletter, Order Confirmation, Password Reset, Promotional/Sale, Event Invitation, Feedback Request, Shipping/Delivery Update, Account Verification, Onboarding Tutorial.",
+ "Use realistic, professional placeholder text — never use lorem ipsum.",
+ "Always provide both subject and previewText for EmailTemplate.",
+ "Use EmailSection to group related content areas (header, body, footer sections).",
+ "Use EmailDivider between major sections for visual separation.",
+ "For multi-column layouts (features, pricing comparisons), use EmailColumns with EmailColumn children.",
+ "Keep email designs clean and focused — avoid too many colors or fonts.",
+ "Use EmailButton with descriptive labels and realistic href URLs.",
+ "For images, use publicly accessible URLs like https://picsum.photos/seed/KEYWORD/600/300.",
+ "When the user asks to modify an existing email, regenerate the full EmailTemplate with the requested changes applied.",
+ "Use EmailCodeBlock for multi-line code (API examples, install commands). Set the language prop for syntax context.",
+ "Use EmailCodeInline for short inline code references within EmailText (e.g. variable names, CLI commands).",
+ "Use EmailMarkdown when the content includes rich formatting like bold, italic, links, or lists — it's more flexible than plain EmailText.",
+ "Use EmailHeaderSideNav for a professional header with logo left and nav links right.",
+ "Use EmailHeaderCenteredNav for a centered brand header with logo on top and nav links below.",
+ "Use EmailHeaderSocial for a header with logo left and social media icons right.",
+ "Place the header as the FIRST child of EmailTemplate, followed by an EmailDivider.",
+ "Use EmailFooterCentered for a centered footer with logo, company name, social icons, and contact info.",
+ "Use EmailFooterTwoColumn for a two-column footer with logo and info on the left, social icons and address on the right.",
+ "Place the footer as the LAST child of EmailTemplate, after an EmailDivider.",
+ "Use EmailArticle for blog post or newsletter article blocks with hero image, category, title, description, and CTA.",
+ "Use EmailProductCard for product showcases with image, title, description, price, and buy button.",
+ "Use EmailFeatureGrid for a 2x2 grid of features with icons. Provide exactly 4 EmailFeatureItem children.",
+ "Use EmailFeatureList for a vertical list of features with icons and dividers. Any number of EmailFeatureItem children.",
+ "Use EmailNumberedSteps for step-by-step guides. Steps are auto-numbered. Provide EmailStepItem children.",
+ "Use EmailCheckoutTable for cart/order summary tables. Provide EmailCheckoutItem children with product details.",
+ "Use EmailPricingCard for pricing plans with feature lists. Provide EmailPricingFeature children for each feature line.",
+ "Use EmailTestimonial for customer quotes with avatar, name, and role.",
+ "Use EmailSurveyRating for feedback/NPS emails with a 1-5 rating scale.",
+ "Use EmailStats for displaying key metrics. Provide EmailStatItem children with value and label.",
+ "Use EmailImageGrid for a 2x2 image gallery. Provide up to 4 EmailImage children.",
+ "Use EmailAvatar for a single avatar image. Set rounded='full' for circular or rounded='md' for rounded-square. Default size is 42px.",
+ "Use EmailAvatarGroup for overlapping stacked avatars. Provide EmailAvatar children. Great for showing team members or participants.",
+ "Use EmailAvatarWithText for an avatar with name and role text. Optionally wrap in a link with href. Great for author attribution in articles.",
+ "Use EmailList for numbered lists with circular badges. Provide EmailListItem children with title and description.",
+ "Use EmailCustomerReview for a star rating distribution summary. Provide counts for each rating level (rating1-rating5) and totalReviews.",
+ "Use EmailBentoGrid for a bento-style marketing layout. Provide a dark hero section and EmailBentoItem children for product cards below.",
+];
+
+// ── Prompt options (email only) ──
+
+export const emailPromptOptions: PromptOptions = {
+ examples: emailExamples,
+ additionalRules: emailAdditionalRules,
+};
+
+// ── Ready-to-use library ──
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export const emailLibrary = createLibrary({
+ root: "EmailTemplate",
+ componentGroups: emailComponentGroups,
+ components: [
+ EmailTemplate,
+ EmailSection,
+ EmailColumns,
+ EmailColumn,
+ EmailHeaderSideNav,
+ EmailHeaderCenteredNav,
+ EmailHeaderSocial,
+ EmailNavLink,
+ EmailSocialIcon,
+ EmailFooterCentered,
+ EmailFooterTwoColumn,
+ EmailHeading,
+ EmailText,
+ EmailButton,
+ EmailImage,
+ EmailDivider,
+ EmailLink,
+ EmailCodeBlock,
+ EmailCodeInline,
+ EmailMarkdown,
+ EmailArticle,
+ EmailProductCard,
+ EmailFeatureItem,
+ EmailFeatureGrid,
+ EmailFeatureList,
+ EmailStepItem,
+ EmailNumberedSteps,
+ EmailCheckoutItem,
+ EmailCheckoutTable,
+ EmailPricingFeature,
+ EmailPricingCard,
+ EmailTestimonial,
+ EmailSurveyRating,
+ EmailStatItem,
+ EmailStats,
+ EmailImageGrid,
+ EmailAvatar,
+ EmailAvatarGroup,
+ EmailAvatarWithText,
+ EmailListItem,
+ EmailList,
+ EmailCustomerReview,
+ EmailBentoItem,
+ EmailBentoGrid,
+ ] as any[],
+});
diff --git a/packages/react-email/src/unions.ts b/packages/react-email/src/unions.ts
new file mode 100644
index 000000000..96d8068e5
--- /dev/null
+++ b/packages/react-email/src/unions.ts
@@ -0,0 +1,54 @@
+import { z } from "zod";
+import { EmailArticle } from "./components/Article";
+import { EmailAvatarGroup } from "./components/AvatarGroup";
+import { EmailAvatarWithText } from "./components/AvatarWithText";
+import { EmailBentoGrid } from "./components/BentoGrid";
+import { EmailButton } from "./components/Button";
+import { EmailCheckoutTable } from "./components/CheckoutTable";
+import { EmailCodeBlock } from "./components/CodeBlock";
+import { EmailCodeInline } from "./components/CodeInline";
+import { EmailCustomerReview } from "./components/CustomerReview";
+import { EmailDivider } from "./components/Divider";
+import { EmailFeatureGrid } from "./components/FeatureGrid";
+import { EmailFeatureList } from "./components/FeatureList";
+import { EmailHeading } from "./components/Heading";
+import { EmailImage } from "./components/Image";
+import { EmailImageGrid } from "./components/ImageGrid";
+import { EmailLink } from "./components/Link";
+import { EmailList } from "./components/List";
+import { EmailMarkdown } from "./components/Markdown";
+import { EmailNumberedSteps } from "./components/NumberedSteps";
+import { EmailPricingCard } from "./components/PricingCard";
+import { EmailProductCard } from "./components/ProductCard";
+import { EmailStats } from "./components/Stats";
+import { EmailSurveyRating } from "./components/SurveyRating";
+import { EmailTestimonial } from "./components/Testimonial";
+import { EmailText } from "./components/Text";
+
+export const EmailLeafChildUnion = z.union([
+ EmailHeading.ref,
+ EmailText.ref,
+ EmailButton.ref,
+ EmailImage.ref,
+ EmailDivider.ref,
+ EmailLink.ref,
+ EmailCodeBlock.ref,
+ EmailCodeInline.ref,
+ EmailMarkdown.ref,
+ EmailArticle.ref,
+ EmailProductCard.ref,
+ EmailFeatureGrid.ref,
+ EmailFeatureList.ref,
+ EmailNumberedSteps.ref,
+ EmailCheckoutTable.ref,
+ EmailPricingCard.ref,
+ EmailTestimonial.ref,
+ EmailSurveyRating.ref,
+ EmailStats.ref,
+ EmailImageGrid.ref,
+ EmailAvatarGroup.ref,
+ EmailAvatarWithText.ref,
+ EmailList.ref,
+ EmailCustomerReview.ref,
+ EmailBentoGrid.ref,
+]);
diff --git a/packages/react-email/tsconfig.build.json b/packages/react-email/tsconfig.build.json
new file mode 100644
index 000000000..78e7883b6
--- /dev/null
+++ b/packages/react-email/tsconfig.build.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2017",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "dist",
+ "rootDir": "src",
+ "strict": true,
+ "esModuleInterop": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "react-jsx",
+ "skipLibCheck": true
+ },
+ "include": ["src"],
+ "exclude": ["node_modules", "dist"]
+}
diff --git a/packages/react-email/tsconfig.json b/packages/react-email/tsconfig.json
new file mode 100644
index 000000000..6021a9fde
--- /dev/null
+++ b/packages/react-email/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "compilerOptions": {
+ "target": "ES2017",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "declaration": true,
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "react-jsx",
+ "skipLibCheck": true
+ },
+ "include": ["src"],
+ "exclude": ["node_modules", "dist"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4ca735df6..3a4984b0e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -64,7 +64,7 @@ importers:
fumadocs-mdx:
specifier: 14.2.8
fumadocs-ui:
specifier: 16.6.5
@@ -261,6 +261,70 @@ importers:
specifier: ~5.9.2
version: 5.9.3
+ examples/react-email:
+ dependencies:
+ '@openuidev/cli':
+ specifier: workspace:*
+ version: link:../../packages/openui-cli
+ '@openuidev/react-email':
+ specifier: workspace:*
+ version: link:../../packages/react-email
+ '@openuidev/react-headless':
+ specifier: workspace:*
+ version: link:../../packages/react-headless
+ '@openuidev/react-lang':
+ specifier: workspace:*
+ version: link:../../packages/react-lang
+ '@react-email/components':
+ specifier: ^0.0.41
+ '@react-email/render':
+ specifier: ^1.0.6
+ lucide-react:
+ specifier: ^0.562.0
+ version: 0.562.0([email protected])
+ next:
+ specifier: 16.1.6
+ openai:
+ specifier: ^6.22.0
+ react:
+ specifier: 19.2.3
+ version: 19.2.3
+ react-dom:
+ specifier: 19.2.3
+ version: 19.2.3([email protected])
+ devDependencies:
+ '@tailwindcss/postcss':
+ specifier: ^4
+ version: 4.2.1
+ '@types/node':
+ specifier: ^20
+ version: 20.19.35
+ '@types/react':
+ specifier: ^19
+ version: 19.2.14
+ '@types/react-dom':
+ specifier: ^19
+ version: 19.2.3(@types/[email protected])
+ eslint:
+ specifier: ^9
+ version: 9.29.0([email protected])
+ eslint-config-next:
+ specifier: 16.1.6
+ tailwindcss:
+ specifier: ^4
+ version: 4.2.1
+ tsx:
+ specifier: ^4.19.2
+ version: 4.20.3
+ typescript:
+ specifier: ^5
+ version: 5.9.3
+
examples/shadcn-chat:
dependencies:
'@openuidev/react-headless':
@@ -501,6 +565,31 @@ importers:
specifier: ^22.15.32
version: 22.15.32
+ packages/react-email:
+ dependencies:
+ '@openuidev/react-lang':
+ specifier: workspace:*
+ version: link:../react-lang
+ '@react-email/components':
+ specifier: ^0.0.41
+ react:
+ specifier: '>=19.0.0'
+ version: 19.2.4
+ react-dom:
+ specifier: '>=19.0.0'
+ version: 19.2.4([email protected])
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@types/react':
+ specifier: ^19
+ version: 19.2.14
+ typescript:
+ specifier: ^5
+ version: 5.9.3
+
packages/react-headless:
dependencies:
'@ag-ui/core':
@@ -3774,6 +3863,138 @@ packages:
'@radix-ui/[email protected]':
resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==}
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-ZSD2SxVSgUjHGrB0Wi+4tu3MEpB4fYSbezsFNEJk2xCWDBkFiOeEsjTmR5dvi+CxTK691hQTQlHv0XWuP7ENTg==}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-HYHrhyVGt7rdM/ls6FuuD6XE7fa7bjZTJqB2byn6/oGsfiEZaogY77OtoLL/mrQHjHjZiJadtAMSik9XLcm7+A==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-4DE4yPSgKEOnZMzcrDvRuD6mxsNxOex0hCYEG9F9q23geYgb2WCCeGBvIUXVzK69l703Dg4Vzrd5qUjl+JfcwA==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-MmAsOzdJpzsnY2cZoPHFPk6uDO/Ncpb4Kh1hAt9UZc1xOW3fIzpe1Pi9y9p6wwUmpaeeDalJxAxH6/fnTquinA==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-Lqq17l7ShzJG/d3b1w/+lVO+gp2FM05ZUo/nW0rjxB8xBICXOVv6PqjDnn3FXKssvhO5qAV20lHM6S+spRhEwQ==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-WUI3wHwra3QS0pwrovSU6b0I0f3TvY33ph0y44LuhSYDSQlMRyeOzgoT6HRDY5FXMDF57cHYq9WoKwpwP0yd7Q==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-Qo2IQo0ru2kZq47REmHW3iXjAQaKu4tpeq/M8m1zHIVwKduL2vYOBQWbC2oDnMtWPmkBjej6XxgtZByxM6cCFg==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-4zjq23oT9APXkerqeslPH3OZWuh5X4crHK6nx82mVHV2SrLba8+8dPEnWbaACWTNjOCbcLIzaC9unk7Wq2MIXw==}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-X2Ii6dDFMF+D4niNwMAHbTkeCjlYYnMsd7edXOsi0JByxt9wNyZ9EnhFiBoQdqkE+SMDcu8TlNNttMrf5sJeMA==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-xF2GqsvBrp/HbRHWEfOgSfRFX+Q8I5KBEIG5+Lv3Vb2R/NYr0s8A5JhHHGf2pWBMJdbP4B2WHgj/VUrhy8dkIg==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-S1gZHVhwOsd1Iad5IFhpfICwNPMGPJidG/Uysy1AwmspyoAP5a4Iw3OWEpINFdgh9MHladbxcLKO2AJO+cA9Lw==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-qJhbOQy5VW5qzU74AimjAR9FRFQfrMa7dn4gkEXKMB/S9xZN8e1yC1uA9C15jkXI/PzmJ0muDIWmFwatm5/+VA==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-aGc8Y6U5C3igoMaqAJKsCpkbm1XjguQ09Acd+YcTKwjnC2+0w3yGUJkjWB2vTx4tN8dCqQCXO8FmdJpMfOA9EQ==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-vF+xxQk2fGS1CN7UPQDbzvcBGfffr+GjTPNiWM38fhBfsLv6A/YUfaqxWlmL7zLzVmo0K2cvvV9wxlSyNba1aQ==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-UQA9pVm5sbflgtg3EX3FquUP4aMBzmLReLbGJ6DZQZnAskBF36aI56cRykDq1o+1jT+CKIK1CducPYziaXliag==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-F7j9FJ0JN/A4d7yr+aw28p4uX7VLWs7hTHtLo7WRyw4G+Lit6Zucq4UWKRxJC8lpsUdzVmG7aBJnKOT+urqs/w==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-RnRehYN3v9gVlNMehHPHhyp2RQo7+pSkHDtXPvg3s0GbzM9SQMW4Qrf8GRNvtpLC4gsI+Wt0VatNRUFqjvevbw==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-ZtJ3noggIvW1ZAryoui95KJENKdCzLmN5F7hyZY1F/17B1vwzuxHB7YkuCg0QqHjDivc5axqYEYdIOw4JIQdUw==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-HkCdnEjvK3o+n0y0tZKXYhIXUNPDx+2vq1dJTmqappVHXS5tXS6W5JOPZr5j+eoZ8gY3PShI2LWj5rWF7ZEtIQ==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-FjqF9xQ8FoeUZYKSdt8sMIKvoT9XF8BrzhT3xiFKdEMwYNbsDflcjfErJe3jb7Wj/es/lKTbV5QR1dnLzGpL3w==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-BH00cZSeFfP9HiDASl+sPHi7Hh77W5nzDgdnxtsVr/m3uQD9g180UwxcE3PhOfx0vRdLzQUU8PtmvvDfbztKQg==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
+ '@react-email/[email protected]':
+ resolution: {integrity: sha512-cMNE02y8172DocpNGh97uV5HSTawaS4CKG/zOku8Pu+m6ehBKbAjgtQZDIxhgstw8+TWraFB8ltS1DPjfG8nLA==}
+ engines: {node: '>=18.0.0'}
+ peerDependencies:
+ react: ^18.0 || ^19.0 || ^19.0.0-rc
+
'@react-native/[email protected]':
resolution: {integrity: sha512-9I5l3pGAKnlpQ15uVkeB9Mgjvt3cZEaEc8EDtdexvdtZvLSjtwBzgourrOW4yZUijbjJr8h3YO2Y0q+THwUHTA==}
engines: {node: '>= 20.19.4'}
@@ -3972,6 +4193,9 @@ packages:
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
+ '@selderee/[email protected]':
+ resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}
+
'@shikijs/[email protected]':
resolution: {integrity: sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==}
@@ -6120,6 +6344,9 @@ packages:
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
+ resolution: {integrity: sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==}
+
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
@@ -6603,12 +6830,19 @@ packages:
resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
+ resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==}
resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
+ resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}
+
resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}
engines: {node: '>= 0.8'}
@@ -7019,6 +7253,9 @@ packages:
resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==}
engines: {node: '>=0.10'}
+ resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}
+
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
engines: {node: '>=6'}
@@ -7206,6 +7443,11 @@ packages:
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
+ resolution: {integrity: sha512-t8eP0dXRJMtMvBojtkcsA7n48BkauktUKzfkPSCq85ZMTJ0v76Rke4DYz01omYpPTUh4p/f7HePgRo3ebG8+QQ==}
+ engines: {node: '>= 16'}
+ hasBin: true
+
resolution: {integrity: sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==}
@@ -7213,6 +7455,11 @@ packages:
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-OvAXqwq57uOk+WZqFFNCMZz8yDp8BD3WazW1wAKHUrPbbdr89K9DWS6JXY09vd9xNdPNeurI8DU/X4flcfaD8A==}
+ peerDependencies:
+ react: ^18.0 || ^19.0
+
resolution: {integrity: sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==}
@@ -7904,6 +8151,9 @@ packages:
resolution: {integrity: sha512-9m4m5GSgXjL4AjumKzq1Fgfp3Z8rsvjRNbnkVwfu2ImRqE5D0LnY2QfDen18FSY9C573YU5XxSapdHZTZ2WolA==}
+ resolution: {integrity: sha512-e6qHKe3a9HWr0oMRVDTRhKce+bRO8VGQR3NyVwcjwrbhMmFCX9KszEV35+rn4AdilFAq9VPxP/Fe1wC9Qjd2lw==}
+
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
@@ -7941,6 +8191,9 @@ packages:
resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==}
engines: {node: '>= 14.16'}
+ resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==}
+
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -8271,6 +8524,9 @@ packages:
'@types/react':
optional: true
+ resolution: {integrity: sha512-I42jl7L3Ze6kZaq+7zXWSunBa3b1on5yfvUW6Eo/3fFOj6dZ5Bqmcd264nJbTK/gn1HjjILAjSwnZbV4RpSaNQ==}
+
resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==}
engines: {node: '>=0.10.0'}
@@ -8585,6 +8841,9 @@ packages:
resolution: {integrity: sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ==}
+ resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
+
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
@@ -13387,6 +13646,238 @@ snapshots:
'@radix-ui/[email protected]': {}
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ prismjs: 1.30.0
+ react: 19.2.3
+
+ dependencies:
+ prismjs: 1.30.0
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ '@react-email/body': 0.0.11([email protected])
+ '@react-email/button': 0.0.19([email protected])
+ '@react-email/code-block': 0.0.13([email protected])
+ '@react-email/code-inline': 0.0.5([email protected])
+ '@react-email/column': 0.0.13([email protected])
+ '@react-email/container': 0.0.15([email protected])
+ '@react-email/font': 0.0.9([email protected])
+ '@react-email/head': 0.0.12([email protected])
+ '@react-email/heading': 0.0.15([email protected])
+ '@react-email/hr': 0.0.11([email protected])
+ '@react-email/html': 0.0.11([email protected])
+ '@react-email/img': 0.0.11([email protected])
+ '@react-email/link': 0.0.12([email protected])
+ '@react-email/markdown': 0.0.15([email protected])
+ '@react-email/preview': 0.0.13([email protected])
+ '@react-email/render': 1.1.2([email protected]([email protected]))([email protected])
+ '@react-email/row': 0.0.12([email protected])
+ '@react-email/section': 0.0.16([email protected])
+ '@react-email/tailwind': 1.0.5([email protected])
+ '@react-email/text': 0.1.4([email protected])
+ react: 19.2.3
+ transitivePeerDependencies:
+ - react-dom
+
+ dependencies:
+ '@react-email/body': 0.0.11([email protected])
+ '@react-email/button': 0.0.19([email protected])
+ '@react-email/code-block': 0.0.13([email protected])
+ '@react-email/code-inline': 0.0.5([email protected])
+ '@react-email/column': 0.0.13([email protected])
+ '@react-email/container': 0.0.15([email protected])
+ '@react-email/font': 0.0.9([email protected])
+ '@react-email/head': 0.0.12([email protected])
+ '@react-email/heading': 0.0.15([email protected])
+ '@react-email/hr': 0.0.11([email protected])
+ '@react-email/html': 0.0.11([email protected])
+ '@react-email/img': 0.0.11([email protected])
+ '@react-email/link': 0.0.12([email protected])
+ '@react-email/markdown': 0.0.15([email protected])
+ '@react-email/preview': 0.0.13([email protected])
+ '@react-email/render': 1.1.2([email protected]([email protected]))([email protected])
+ '@react-email/row': 0.0.12([email protected])
+ '@react-email/section': 0.0.16([email protected])
+ '@react-email/tailwind': 1.0.5([email protected])
+ '@react-email/text': 0.1.4([email protected])
+ react: 19.2.4
+ transitivePeerDependencies:
+ - react-dom
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ md-to-react-email: 5.0.5([email protected])
+ react: 19.2.3
+
+ dependencies:
+ md-to-react-email: 5.0.5([email protected])
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ html-to-text: 9.0.5
+ prettier: 3.5.3
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ react-promise-suspense: 0.3.4
+
+ dependencies:
+ html-to-text: 9.0.5
+ prettier: 3.5.3
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ react-promise-suspense: 0.3.4
+
+ dependencies:
+ html-to-text: 9.0.5
+ prettier: 3.5.3
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ react-promise-suspense: 0.3.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
+ dependencies:
+ react: 19.2.3
+
+ dependencies:
+ react: 19.2.4
+
'@react-native/[email protected]': {}
'@react-native/[email protected](@babel/[email protected])':
@@ -13616,6 +14107,11 @@ snapshots:
'@rtsao/[email protected]': {}
+ '@selderee/[email protected]':
+ dependencies:
+ domhandler: 5.0.3
+ selderee: 0.11.0
+
'@shikijs/[email protected]':
dependencies:
'@shikijs/types': 3.23.0
@@ -15754,7 +16250,7 @@ snapshots:
dependencies:
debug: 3.2.7
is-core-module: 2.16.1
- resolve: 1.22.10
+ resolve: 1.22.11
transitivePeerDependencies:
- supports-color
@@ -15773,7 +16269,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
@@ -15795,7 +16291,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.29.0([email protected])
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -16120,6 +16616,8 @@ snapshots:
+
@@ -16318,7 +16816,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@mdx-js/mdx': 3.1.1
'@standard-schema/spec': 1.1.0
@@ -16707,10 +17205,25 @@ snapshots:
- '@noble/hashes'
optional: true
+ dependencies:
+ '@selderee/plugin-htmlparser2': 0.11.0
+ deepmerge: 4.3.1
+ dom-serializer: 2.0.0
+ htmlparser2: 8.0.2
+ selderee: 0.11.0
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ entities: 4.5.0
+
dependencies:
depd: 2.0.0
@@ -17167,6 +17680,8 @@ snapshots:
dependencies:
language-subtag-registry: 0.3.23
+
@@ -17281,6 +17796,10 @@ snapshots:
dependencies:
yallist: 3.1.1
+ dependencies:
+ react: 19.2.3
+
dependencies:
react: 19.2.4
@@ -17317,10 +17836,22 @@ snapshots:
+
+ dependencies:
+ marked: 7.0.4
+ react: 19.2.3
+
+ dependencies:
+ marked: 7.0.4
+ react: 19.2.4
+
dependencies:
'@types/mdast': 4.0.4
@@ -18554,6 +19085,11 @@ snapshots:
entities: 6.0.1
optional: true
+ dependencies:
+ leac: 0.6.0
+ peberminta: 0.9.0
+
@@ -18580,6 +19116,8 @@ snapshots:
+
@@ -19045,6 +19583,10 @@ snapshots:
- supports-color
- utf-8-validate
+ dependencies:
+ fast-deep-equal: 2.0.1
+
@@ -19558,6 +20100,10 @@ snapshots:
dependencies:
compute-scroll-into-view: 3.1.1
+ dependencies:
+ parseley: 0.12.1
+