# EmailUX Gmail HTML Inserter (Chrome Extension)
Source: https://docs.emailux.com/addins/gmail-html-inserter
Paste and insert HTML directly into Gmail compose using the EmailUX Chrome extension.
The **EmailUX Gmail HTML Inserter** is a Chrome extension that lets you paste HTML and insert it directly into a Gmail compose window. Perfect for sending designed templates, announcements, or any custom HTML content through Gmail.
***
## How It Works
1. Install the Chrome extension named **"EmailUX HTML Inserter"** from the Chrome Web Store.
2. Open Gmail and click **Compose** to start a new email.
3. In the compose window, you will see an option labeled **EmailUX Insert HTML**.
4. Paste your HTML into the provided input.
5. Click **Insert HTML**.
6. Your HTML will be inserted into the email body instantly.
***
## What You Can Use It For
* Sending HTML email templates
* Adding formatted announcements
* Using EmailUX-designed templates
* Sending custom layouts inside Gmail
***
## Support
If you need help or have any questions, visit our support page:
π **[https://www.emailux.com/support](https://www.emailux.com/support)**
Weβre happy to assist you.
# EmailUX Outlook HTML Import Add-in
Source: https://docs.emailux.com/addins/outlook-html-import
How to use Outlook HTML Import Add-in
The **EmailUX Outlook HTML Import Add-in** allows you to easily paste HTML code and insert it directly into a new Outlook email. This is useful when you want to send designed templates, announcements, or any custom HTML content through Outlook.
***
## How It Works
1. Install the add-in in Outlook.
2. Open a new email.
3. On the right side, open **EmailUX Outlook HTML Import**.
4. Paste your HTML into the box.
5. Click **Insert HTML**.
6. Your HTML will appear instantly inside the email body.
***
## What You Can Use It For
* Sending HTML email templates
* Adding formatted announcements
* Using EmailUX-designed templates
* Sending custom layouts inside Outlook
***
## Support
If you need help or have any questions, visit our support page:
π **[https://www.emailux.com/support](https://www.emailux.com/support)**
Weβre happy to assist you.
# API client (@emailux/api-client)
Source: https://docs.emailux.com/api/api-client
TypeScript client for EmailUX render and deliver APIs.
The [`@emailux/api-client`](https://www.npmjs.com/package/@emailux/api-client) package calls the EmailUX HTTP API: **`render`** (HTML by template) and **`deliver`** (render + send via a provider).
## Installation
```sh npm theme={null}
npm install @emailux/api-client
```
```sh yarn theme={null}
yarn add @emailux/api-client
```
```sh pnpm theme={null}
pnpm add @emailux/api-client
```
```sh bun theme={null}
bun add @emailux/api-client
```
## Default base URL
All requests use:
`https://render.emailux.com`
Override with `baseUrl` in the client options if you use a custom deployment.
**OpenAPI (Swagger):** The live spec for your deployment is at **`{baseUrl}/swagger.json`** (for example [`https://render.emailux.com/swagger.json`](https://render.emailux.com/swagger.json)). Use it for the latest paths, headers, bodies, and response codes.
## Client options
| Option | Description |
| --------------------- | ----------------------------------------------------------------------------------------------- |
| `apiKey` | Required. Sent as `x-api-key`. |
| `baseUrl` | Optional. Defaults to `https://render.emailux.com` (trailing slash is stripped). |
| `defaultLocale` | Optional. Default `en-US`; used when `locale` is omitted on `deliver` / `render`. |
| `fetchImplementation` | Optional. Custom `fetch` (e.g. for tests or edge runtimes). |
| `timeoutMs` | Optional. Request timeout via `AbortSignal`. |
| `provider` | One of `sendgrid`, `gmail`, or `smtp`. Affects **deliver** defaults (see below). |
| `sendgridDomain` | Required when using SendGrid (default provider). Your SendGrid-authenticated domain identifier. |
**Render** in this package is only supported with a **SendGrid domain** configured (`sendgridDomain` is required for `render()`). Delivery can use **SendGrid**, **Gmail**, or **SMTP** via `provider` and optional per-call overrides.
**HTTP mapping:** The client sends your domain as the `x-sendgrid-domain` header on render/deliver. The public API may also document this as `x-domain`; behavior depends on your EmailUX API version.
## `render()` β HTML only
Calls `POST /v1/render` with a JSON body:
* `experience_id` (required)
* `version` (optional)
* `locale` (optional; falls back to `defaultLocale`)
* `data` (object; defaults to `{}`)
### Response codes (`/v1/render`)
| Status | Meaning |
| ------ | ----------------------------------------------- |
| `200` | Success. JSON includes `ok`, `html`, `subject`. |
| `400` | Validation error |
| `401` | Unauthorized |
| `404` | Not found |
On success, the client returns `{ ok: true, status, html?, subject? }`. On failure, `{ ok: false, status, error }` with `error.message` and optional `error.body`.
### Example (SendGrid domain β required for render)
```ts theme={null}
import { EmailUxApiClient } from '@emailux/api-client';
const client = new EmailUxApiClient({
apiKey: process.env.EMAILUX_API_KEY!,
sendgridDomain: 'mail.yourdomain.com', // your EmailUX / SendGrid domain
});
const result = await client.render({
experienceId: 'welcome-email',
version: 1,
locale: 'en-US',
data: { firstName: 'Ada' },
});
if (result.ok) {
console.log(result.subject, result.html?.slice(0, 200));
} else {
console.error(result.status, result.error);
}
```
## `deliver()` β render and queue send
Calls `POST /v1/deliver` with a JSON body:
* `experience_id` (required)
* `tenant` β not set by this client; use API keys and headers if your backend requires it when `x-domain` is omitted (see `swagger.json` for your deployment).
* `version`, `locale` (optional)
* `channel_data` (required): `toEmail`, `fromEmail`, optional `toEmailName`, `fromEmailName`
* `data` (object; defaults to `{}`)
Optional headers the client may send:
* `x-provider`: `gmail` or `smtp` when using those providers (SendGrid uses the domain header path, so `x-provider` is omitted for SendGrid).
### Response codes (`/v1/deliver`)
| Status | Meaning |
| ------ | --------------------------------------- |
| `200` | Success. JSON includes `ok`, `message`. |
| `400` | Validation error |
| `401` | Unauthorized |
| `404` | Not found |
| `502` | Provider error |
### SendGrid
Default provider is SendGrid; `sendgridDomain` is required on the client.
```ts theme={null}
import { EmailUxApiClient } from '@emailux/api-client';
const client = new EmailUxApiClient({
apiKey: process.env.EMAILUX_API_KEY!,
provider: 'sendgrid',
sendgridDomain: 'mail.yourdomain.com',
});
const result = await client.deliver({
experienceId: 'order-confirmation',
channelData: {
toEmail: 'customer@example.com',
toEmailName: 'Customer',
fromEmail: 'orders@yourdomain.com',
fromEmailName: 'Your Store',
},
data: { orderId: '12345' },
});
if (result.ok) {
console.log(result.message);
} else {
console.error(result.status, result.error);
}
```
You can omit `provider: 'sendgrid'`; the client still requires `sendgridDomain` for that configuration.
### Gmail
```ts theme={null}
import { EmailUxApiClient } from '@emailux/api-client';
const client = new EmailUxApiClient({
apiKey: process.env.EMAILUX_API_KEY!,
provider: 'gmail',
});
const result = await client.deliver({
experienceId: 'order-confirmation',
channelData: {
toEmail: 'customer@example.com',
fromEmail: 'noreply@yourdomain.com',
},
data: { orderId: '12345' },
});
```
Per-call override:
```ts theme={null}
await client.deliver({
...params,
provider: 'gmail',
});
```
### SMTP
```ts theme={null}
import { EmailUxApiClient } from '@emailux/api-client';
const client = new EmailUxApiClient({
apiKey: process.env.EMAILUX_API_KEY!,
provider: 'smtp',
});
const result = await client.deliver({
experienceId: 'order-confirmation',
channelData: {
toEmail: 'customer@example.com',
fromEmail: 'noreply@yourdomain.com',
},
data: { orderId: '12345' },
});
```
## Errors and non-HTTP failures
* HTTP `4xx` / `5xx` responses set `ok: false` and include `status` and `error` (with parsed body when JSON).
* Network timeouts, aborts, or other thrown errors surface as `ok: false`, `status: 0`, and `error.message` from the thrown error.
## Requirements
Node.js **>= 18** (native `fetch`).
## Source and license
Package source lives under [`packages/api-client`](https://github.com/iClasser/emailux/tree/main/packages/api-client) in the EmailUX monorepo. License: MIT.
# A component
Source: https://docs.emailux.com/components/a
Create A component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { A } from "@emailux/a";
export default function EmailTemplate() {
return <>
Docs
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ------------ | ------------------- | -------- | --------------------- | ------------------------------------------------------------------- |
| children | any | No | | |
| dir | "ltr" \| "rtl" | No | "ltr" | Text direction for the content |
| color | string | No | | Hex color |
| noDecoration | boolean | No | false | |
| style | React.CSSProperties | No | | |
| rel | string | No | 'noopener noreferrer' | |
| spacing | string | No | - | Spacing bottom, and the anchor tag will be a block component if set |
# Badge component
Source: https://docs.emailux.com/components/badge
Create Badge tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Badge } from "@emailux/components";
export default function EmailTemplate() {
return <>
Text
>
}
```
## Props
| Name | Type | Required | Default | Description | |
| --------- | --------------- | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | - |
| children | React.ReactNode | string | Yes | β | - |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction for the wrapper cell | |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop | |
| varient | string | No | `default` | β | |
| padding | string | No | `6px 8px` | inside padding | |
| noPadding | boolean | No | false | β | |
# Body component
Source: https://docs.emailux.com/components/body
Create Body wrapper tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Body } from "@emailux/components";
export default function EmailTemplate() {
return
Some title
;
}
```
## Props
| Name | Type | Required | Default | Description |
| ----------------------- | ------------------- | -------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| background | string | Yes | β | β |
| backgroundColor | string | Yes | β | β |
| style | React.CSSProperties | No | - | - |
| width | number or "100%" | No | β | width of container |
| padding | string | No | `12px 20px` | inner padding |
| outerBgColor | string | No | β | When whidth is not `100%` and a number, you can set this value as Hex color value to set the left and right side of the section background color, not the inside |
| borderRadius | string | No | | |
| footer | React.ReactNode | No | | |
| footerWidth | number or "100%" | No | β | width of footer |
| footerPadding | string | No | `0px 20p` | footer padding |
| footerOuterBgColor | string | No | β | |
| footerBackgroundColor | string | No | β | |
| footerStyle | React.CSSProperties | No | - | - |
| backgroundPosition | string | no | "bottom" | when there is background image url this is css property for position |
| backgroundRepeat | string | no | "no-repeat, no-repeat" | when there is background image url this is css property for repeat |
| bgImageTakesAllWrappers | string | no | false | when there is background image url takes all if width is not 100%, but with 100% it already takes all |
| borderWidth | number | No | β | border width of the body |
| borderColor | string | No | β | Border will work if border width is greater than 0 |
| openCounter | boolean | No | `true` | When enabled, appends `` at the end of the body content. This tag has no visual effect on the rendered email. |
All other standard attributes for the `` element are supported.
## Open counter tracking
By default, `Body` appends a `` tag as the last element inside ``. This tag does not affect how the email looks in inboxes and is intended for open-counter tracking in downstream email pipelines.
```tsx theme={null}
// Tracking tag is included by default
...
// Disable the tracking tag
...
```
# BodyContent component
Source: https://docs.emailux.com/components/body-contents
Create BodyContent wrapper tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { BodyContent } from "@emailux/components";
export default function EmailTemplate() {
return <>
HeaderBodyFooter
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ----------------------- | ------------------- | -------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| background | string | Yes | β | β |
| backgroundColor | string | Yes | β | β |
| style | React.CSSProperties | No | - | - |
| width | number or "100%" | No | β | width of container |
| padding | string | No | `12px 20px` | inner padding |
| outerBgColor | string | No | β | When whidth is not `100%` and a number, you can set this value as Hex color value to set the left and right side of the section background color, not the inside |
| borderRadius | string | No | | |
| className | string | no | β | β |
| backgroundPosition | string | no | "bottom" | when there is background image url this is css property for position |
| backgroundRepeat | string | no | "no-repeat, no-repeat" | when there is background image url this is css property for repeat |
| bgImageTakesAllWrappers | string | no | false | when there is background image url takes all if width is not 100%, but with 100% it already takes all |
| borderWidth | number | No | β | border width |
| borderColor | string | No | β | Border will work if border width is greater than 0 |
# Box component
Source: https://docs.emailux.com/components/box
Create Box wrapper tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Box } from "@emailux/components";
export default function EmailTemplate() {
return <>
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ------------------ | ------------------- | -------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| backgroundColor | string | Yes | β | β |
| style | React.CSSProperties | No | - | - |
| width | number or "100%" | No | β | width of container |
| padding | string | No | `10px 16px` | inner padding |
| className | string | no | β | β |
| borderRadius | string | No | | |
| backgroundImageUrl | string | no | | Box background image |
| backgroundPosition | string | no | "bottom" | when there is background image url this is css property for position |
| backgroundRepeat | string | no | "no-repeat, no-repeat" | when there is background image url this is css property for repeat |
| itemCenter | boolean | no | true | Inner items will be aligned center |
| center | boolean | no | true | The box will be positioned center of email |
| borderWidth | number | No | β | border width |
| borderColor | string | No | β | Border will work if border width is greater than 0 |
# Button component
Source: https://docs.emailux.com/components/button
Create Button component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Button } from "@emailux/components";
```
## Props
| Name | Type | Required | Default | Description |
| --------------- | -------------- | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| src | string | Yes | "" | Path or URL to the image |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| href | string | Yes | "" | |
| icon | object | No | | `{ url, alt, width, height }` |
| backgroundColor | string | Yes | "" | |
| align | string | No | "center" | |
| direction | string | No | "ltr" | |
| textColor | string | No | | css color hex |
| borderRadius | string | No | | |
| style | string | No | | CSS style |
| borderWidth | string | No | | CSS border width |
| borderColor | string | No | | CSS border color |
# Card component
Source: https://docs.emailux.com/components/card
Create Card component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Text } from "@emailux/components";
import { Card } from "@emailux/card";
export default function EmailTemplate() {
return <>
Some header}
content={Some content}
footer={Some footer}
headerBackgroundColor='#fff'
contentBackgroundColor='#fff'
footerBackgroundColor='#fff'
borderRadius='24px'
padding='12px 15px'
width='100%'
spacing='20px'
/>
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ---------------------- | --------------- | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| header | React.ReactNode | No | β | |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| content | React.ReactNode | No | β | |
| footer | React.ReactNode | No | β | |
| headerBackgroundColor | string | No | #fff | β |
| contentBackgroundColor | string | No | #fff | β |
| footerBackgroundColor | string | No | #fff | β |
| borderRadius | string | No | `24px` | β |
| padding | string | No | \`\` | inner padding |
| width | string | No | `100%` | |
| headerCenter | boolean | No | undefined | |
| contentCenter | boolean | No | undefined | |
| footerCenter | boolean | No | undefined | |
# Css component
Source: https://docs.emailux.com/components/css
Create Css component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Html, Head } from "@emailux/components";
import { Css } from "@emailux/css";
// Can also be imported from "@emailux/components"
// import { Css } from "@emailux/components";
export default function EmailTemplate() {
return
```
## Props
| Name | Type | Required | Default | Description |
| -------- | --------------------------------- | -------- | ------- | ----------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| style | React.CSSProperties | Yes | β | - |
| selector | Array of strings of css selectors | No | β | |
All other standard Head attributes for the `` element are supported.
# Font component
Source: https://docs.emailux.com/components/font
Create Font component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Font } from "@emailux/components";
export default function EmailTemplate() {
return
}
```
## Props
| Name | Type | Required | Default | Description |
| --------------- | ----------------------------- | -------- | ------- | ----------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| family | String | Yes | β | - |
| url | String | Yes | β | - |
| type | String | Yes | β | "woff2" or "woff" |
| style | String | Yes | β | - |
| weigth | String | Yes | β | 400 |
| targetSelectors | Array of css selector strings | No | β | |
All other standard Head attributes for the `` element are supported.
# Head component
Source: https://docs.emailux.com/components/head
Create Head wrapper component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Head } from " @emailux/components";
export default function EmailTemplate() {
return
Some title
;
}
```
## Props
| Name | Type | Required | Default | Description |
| ---------- | --------------- | -------- | ------------------------- | -------------------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| title | React.ReactNode | No | β | Title |
| defaultCss | string | No | Pre-written CSS for email | You can replace this with your own css |
All other standard Head attributes for the `` element are supported.
# Hr component
Source: https://docs.emailux.com/components/hr
Create Hr component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Hr } from "@emailux/components";
export default function EmailTemplate() {
return <>
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ------- | ------------------- | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| color | string | No | `#e5e5e5` | |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| width | string | No | `100%` | width of seperator |
| align | string | No | `center` | If width is less than 100% then alignment becomes important |
| style | React.CSSProperties | No | | |
| height | number | No | `1` | |
# Html component
Source: https://docs.emailux.com/components/html
Create Html wrapper tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Html } from "@emailux/components";
export default function Email() {
return Hello;
}
```
## Props
| Name | Type | Required | Default | Description |
| -------------- | ----------------------- | -------- | ------- | ----------------------------------------------------------------------- |
| children | any | Yes | β | Content of the email document |
| dir | "ltr" \| "rtl" | No | "ltr" | Text direction for the document, it will affect all components |
| lang | string | No | "en" | Language of the document |
| defaultSpacing | string one value in css | No | "20px" | This will set the whole email default spacing (padding bottom defaults) |
All other standard HTML attributes for the `` element are supported.
# Img component
Source: https://docs.emailux.com/components/img
Create Img component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Img } from "@emailux/components";
export default function Email() {
return ;
}
```
## Alignment & styling
```tsx theme={null}
```
## Props
| Name | Type | Required | Default | Description |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| src | string | Yes | "" | Path or URL to the image |
| alt | string | No | "image" | Alternate description for the image |
| width | number \| string | No | β | Image width. Numbers are treated as px in style |
| height | number \| string | No | β | Image height. Numbers are treated as px in style |
| center | boolean | No | false | Centers the image within the table cell |
| borderRadius | string | No | β | Applied as CSS border-radius on the image |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| padding | string | No | β | Custom padding for container cell; overrides default bottom spacing. In plain mode, applied to the image style. |
| style | React.CSSProperties | No | β | |
| plain | boolean | No | false | Returns plain image without container and spacing |
| href | string | No | - | If you want to convert the image to be clickable |
| maxHeight | number \| string | No | β | |
| maxWidth | number \| string | No | β | |
# Table component
Source: https://docs.emailux.com/components/table
Create Table component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
### Rows and columns
```tsx theme={null}
import { Table } from "@emailux/components";
export default function ExampleRowsAndCols() {
return (
Cell 1Cell 2Cell 3Cell 4
);
}
```
### Inherit wrapper styles via context
`padding`, `border`, and `borderColor` from `Table` flow to `Table.Row` and `Table.Col` via context.
```tsx theme={null}
export default function ExampleContext() {
return (
LeftRight
);
}
```
### Override per row or col
`Table.Row` can override context for its children; `Table.Col` can override for itself.
```tsx theme={null}
export default function ExampleOverrides() {
return (
Compact AEmphasized B
);
}
```
### Using colSpan and width
`Table.Col` extends native `td` props, so attributes like `colSpan` work as expected.
```tsx theme={null}
export default function ExampleColSpan() {
return (
Section HeaderItem A$10
);
}
```
### Alignment, vertical alignment, and background
```tsx theme={null}
export default function ExampleAlignment() {
return (
Centered TopAlso Centered
);
}
```
## Props
### `Table`
| Name | Type | Required | Default | Description | | | | | | |
| ----------- | --------------- | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | - | ------- | ------ | -- | -------- | ------------------------------------------- |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction | | | | | | |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop | | padding | string | No | `"10px"` | Inner padding applied to cells via context. |
| border | boolean | No | `false` | Enables cell borders. | | | | | | |
| borderColor | string | No | `"#e5e5e5"` | Border color when `border` is enabled. | | | | | | |
| width | string | No | `"100%"` | Width of the rendered table. | | | | | | |
| children | React.ReactNode | Yes | β | Typically one or more `Table.Row`. | | | | | | |
Notes:
* When `spacing` is provided, an outer wrapper table is used to apply spacing.
* `padding`, `border`, and `borderColor` are provided to descendants via context and can be overridden by `Table.Row` or `Table.Col`.
* Borders are applied per cell with side-specific rules to avoid double borders (top/left on first row/column; right/bottom on all cells).
### `Table.Row`
| Name | Type | Required | Default | Description |
| --------------- | ------------------------------- | -------- | ---------- | ----------------------------------------------------- |
| dir | "ltr" \| "rtl" | No | "ltr" | Text direction for the content |
| children | React.ReactNode | Yes | β | One or more `Table.Col`. |
| backgroundColor | string | No | β | Background color for the row. |
| align | `"left" \| "center" \| "right"` | No | `"left"` | Horizontal text alignment for cells in the row. |
| valign | `"top" \| "middle" \| "bottom"` | No | `"middle"` | Vertical alignment for cells in the row. |
| padding | string | No | β | Overrides context `padding` for this row's cells. |
| border | boolean | No | β | Overrides context `border` for this row's cells. |
| borderColor | string | No | β | Overrides context `borderColor` for this row's cells. |
### `Table.Col`
| Name | Type | Required | Default | Description |
| --------------- | --------------- | -------- | ------- | --------------------------------------------------------------------------------------- |
| dir | "ltr" \| "rtl" | No | "ltr" | Text direction for the content |
| children | React.ReactNode | Yes | β | Content for the cell. |
| backgroundColor | string | No | β | Background color for the cell. |
| padding | string | No | β | Padding for the cell (defaults from context if not provided). |
| border | boolean | No | β | Whether to set a border on the cell (defaults from context if not provided). |
| borderColor | string | No | β | Color for the cell border when `border` is set (defaults from context if not provided). |
| width | string | No | β | Width of the cell. |
| align | string | No | β | alignment of cell |
Additional:
* `Table.Col` extends native `td` props, so attributes like `colSpan` and `rowSpan` are supported.
# Text component
Source: https://docs.emailux.com/components/text
Create Text component
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Text } from "@emailux/components";
export default function EmailTemplate() {
return
Hello world!
;
}
```
## Props
| Name | Type | Required | Default | Description |
| ------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| children | React.ReactNode | Yes | β | Content of the email document |
| color | string | No | β | `#000` |
| fontSize | string | No | β | |
| fontWeight | string | No | β | |
| lineHeight | string | No | β | |
| fontFamily | string | No | β | |
| className | string | No | β | |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction for the wrapper cell |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| style | React.CSSProperties | No | β | |
| plain | boolean | No | false | Used when you don't want to use table or margin bottom just a paragraph without spacing |
| letterSpacing | string | No | β | |
| inline | boolean | No | false | Used when you want to write something in one line inside another component without spacing |
| href | string | No | - | If you want to convert the text to link |
| padding | CSS padding style string | No | "" | Only works if its either inline or plain and you can add a css string |
All other standard attributes for the `` element are supported.
# Ul component
Source: https://docs.emailux.com/components/ul
Create Ul wrapper tag
## 1. Install dependencies
Install the EmailUX Email package locally and a few components.
```bash theme={null}
# pnpm
pnpm add @emailux/components
# npm
npm install @emailux/components
# yarn
yarn add @emailux/components
```
## 2. Usage
```tsx theme={null}
import { Ul } from "@emailux/components";
export default function EmailTemplate() {
return <>
....
>
}
```
## Props
| Name | Type | Required | Default | Description |
| ------------- | --------------- | -------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| children | React.ReactNode | Yes | β | Content of the email document |
| dir | "ltr" \| "rtl" | No | Comes from wrapping `Html` component's `dir` context prop which is `ltr` | Text direction for the wrapper cell |
| spacing | string | No | Comes from wrapping `Html` component's `defaultSpacing` context prop which is `20px` | Spacing bottom, by default comes from `Html` defaultSpacing prop |
| color | string | No | β | `#000` |
| fontSize | string | No | β | |
| lineHeight | string | No | β | |
| fontWeight | string | No | β | |
| className | string | No | β | |
| plain | boolean | No | false | Used when you don't want to use table or margin bottom just a paragraph without spacing |
| letterSpacing | string | No | β | |
| paddingLeft | string | No | `20px` | |
# EmailUX Setup
Source: https://docs.emailux.com/getting-started/setup
Create a brand-new with EmailUX.
## 1. Create directory
Create a new folder called `emailux-email-starter` and initialize a new npm project:
```sh theme={null}
mkdir emailux-email-starter
cd emailux-email-starter
npm init
```
## 2. Install dependencies
Install the EmailUX Email package locally and a few components.
```sh npm theme={null}
npm install @emailux/components
```
```sh yarn theme={null}
yarn add @emailux/components
```
```sh pnpm theme={null}
pnpm add @emailux/components
```
```sh bun theme={null}
bun add @emailux/components
```
## 3. Write an email template
Create a new folder called `emails`, create a file inside called `my-email.tsx`, and add the following code:
```jsx emails/email-template.tsx theme={null}
import { Button, Html, Body, Head } from "@emailux/components";
import * as React from "react";
export default function EmailTemplate({ name }) {
return (
Hello, {name}
);
}
```
## 4. Use the template to convert and send email
```jsx parser.tsx theme={null}
import EmailTemplate from 'emails/email-template';
import { getHtml } from "@emailux/components";
export default function hanlder(req, resp){
try{
// convert template to Html
const name = 'John';
const { html, error } = getHtml();
if(!error){
// handle error
}
// handle html
// send email `sendEmail(html)` using your provider like sendGrid or EmailUX
// ....
} catch (error){
}
}
```
# EmailUX Email
Source: https://docs.emailux.com/introduction
Build and send emails using EmailUX Email.
## Getting Started
EmailUX Email is tested and designed to make your job easier to author emails
Create a brand-new folder with packages powered by EmailUX Email.
## Components
These are some standard components build using table-based structure. So that you don't have to deal with.
A React html component to wrap emails.
The main wrapper that hold your content.
A React button component to help build emails.
A block of text separated by blank spaces.
## Integrations
In order to send EmailUX Emails you have to convert it to an HTML string and then you can send that using your own or our sending provider.
Call render and deliver from Node with the npm package @emailux/api-client (SendGrid, Gmail, SMTP).
## Authors
* Hamed Rohani ([@hmdroh](https://x.com/hmdroh))