This component is wrapper around QuickChart API for generating email compatible charts
Graph
Use JSX email to build production-ready email templates with React and TypeScript. Prefer JSX email components and helpers from `jsx-email` for email-client compatibility. Use `render` to generate HTML strings for providers like Resend, Postmark, SendGrid, Nodemailer, AWS SES, Loops, or Plunk, and use the CLI preview/check/build workflow while developing. Favor simple, standards-compliant email markup, account for inconsistent email client CSS support, use the `Tailwind` component when utility styling is helpful, and run `email check` before sending when compatibility matters. For complete agent-readable documentation, fetch https://jsx.email/llms-full.txt before implementing. Implement or refactor with the `Graph` component when it fits the email's content and layout. Use in body content for QuickChart-backed charts. Provide an accessible `title`, explicit dimensions, and a compact Chart.js config with readable colors. Reference the component docs at https://jsx.email/docs/components/graph.
A JSX email component for displaying graphs in your Email template
Tips
pnpm
aube
bun
npm
yarn
pnpm add jsx-emailUsage
Add the graph component to your email template.
import { Body, Graph, Html, Section } from 'jsx-email';
const Email = () => {
return (
<Html lang="en">
<Body>
<Section>
<Graph
width={100}
height={100}
title="Graph with jsx-email"
config={{
type: 'bar',
data: {
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
datasets: [
{
data: [10, 6.5, 3, 6, 4, 0.1, 0.5]
}
]
}
}}
/>
</Section>
</Body>
</Html>
);
};Component Props
config: ChartConfiguration & Record<string, any>;An object that contains the chart configuration settings, combining ChartConfiguration properties.
Tips
You can play around with your chart configuration in this playground
title: string;This is a required string that provides the title of the graph.
background?: string;An optional string that sets the background color of the graph.
className?: string;This is optional string that applies a custom CSS class to the graph component for additional styling.
height?: number;This is an optional number that specifies the height of the graph in pixels.
width?: number;This is an optional number that specifies the width of the graph in pixels.