@openuidev/react-email
v0.1.3
Published
React Email components for OpenUI — 44 email building blocks with defineComponent
Readme
@openuidev/react-email
React Email components for OpenUI — API reference for the pre-built email templates library and prompt options, ready for LLM-driven email generation.
Install
npm install @openuidev/react-email @openuidev/react-lang
# or
pnpm add @openuidev/react-email @openuidev/react-langPeer dependencies: react >=19.0.0, react-dom >=19.0.0, @openuidev/react-lang
Quick Start
1. Generate a system prompt
import { emailLibrary, emailPromptOptions } from "@openuidev/react-email";
const systemPrompt = emailLibrary.prompt(emailPromptOptions);2. Render the email output
import { Renderer } from "@openuidev/react-lang";
import { emailLibrary } from "@openuidev/react-email";
function EmailPreview({ response, isStreaming }) {
return <Renderer response={response} library={emailLibrary} isStreaming={isStreaming} />;
}3. Get the HTML
Install @react-email/render to convert the output to an email-safe HTML string:
npm install @react-email/renderimport { Renderer } from "@openuidev/react-lang";
import { emailLibrary } from "@openuidev/react-email";
import { render } from "@react-email/render";
const html = await render(
<Renderer response={llmResponse} library={emailLibrary} isStreaming={false} />,
{ pretty: true },
);Exports
| Export | Description |
| :------------------- | :------------------------------------------------------------- |
| emailLibrary | Pre-configured Library instance with all 44 email components |
| emailPromptOptions | Prompt options with examples and rules for email generation |
Documentation
Full documentation, guides, and the language specification are available at openui.com.
