Tags
Learn how to use tags with JSX Mail.
As a JSX framework, JSX Mail offers some JSX tags that you can use. All tags were carefully created to ensure compatibility with your email template, so here you can see all the props that each tag accepts.
<a />
The <a />
tag is used to create links in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
href | string | The link URL |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
target | string | The link target |
children | JSX.ElementChildren | The link text |
Example
<b />
The <b />
tag is used to create bold text in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The bold text |
Example
<body />
The <body />
tag is used to create the body of your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The body content |
Example
<br />
The <br />
tag is used to create a line break in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
Example
<button />
The <button />
tag is used to create a button in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
href | string | The button URL |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The button text |
Example
<div />
The <div />
tag is used to create structure in your emails. It is super flexible and JSX Mail automatically compiles it into tables if necessary. It accepts the following props:
Prop | Type | Description |
---|---|---|
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The div content |
className | string | Some class to the result HTML |
container | boolean | If it is a container or not. If container is true , jsx mail will compile your div to a table tag in the html |
section | boolean | If it is a section or not. If section is true , jsx mail will compile your div to a tr tag in the html |
flex | boolean | If true , jsx mail will automatically place each element within its section in a separate td tag. If it is false , JSX Mail will place all elements within your section in a single td . Only sections can have this defined |
alignX | string | The horizontal alignment of the div. Only sections can have this defined |
alignY | string | The vertical alignment of the div. Only sections can have this defined |
Example
- Normal div
- Container div
Every container div must have at least one section div inside it.
The container div is compiled to a table, and the section div is compiled to a table row.
<font />
The <font />
tag is used to create a font in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
href | string | The font URL |
Example
Use the <font />
tag in the <head />
tag.
<h1-6 />
The <h1-6 />
tag is used to create a heading in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
align | string | The text alignment |
className | string | Some class to the result HTML |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The heading text |
Example
<head />
The <head />
tag is used to create the head of your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
children | JSX.ElementChildren | The head content |
Example
<hr />
The <hr />
tag is used to create a horizontal line in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
align | string | The text alignment |
size | number | The size of the line |
width | number | The width of the line |
Example
<html />
The <html />
tag is used to create the HTML of your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
children | JSX.ElementChildren | The HTML content |
lang | string | The HTML language |
Example
<img />
The <img />
tag is used to create an image in your email. See more about it here.
It accepts the following props:
Prop | Type | Description |
---|---|---|
align | string | The text alignment |
border | number | The border size |
height | number | The image height |
width | number | The image width |
src | string | The image path see more |
style | JSX.ElementStyle | Some style to the result HTML see more here |
alt | string | The image alt text |
Example
<li />
The <li />
tag is used to create a list item in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
dir | string | The list direction |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
type | string | The list type |
children | JSX.ElementChildren | The list item text |
Example
<link />
The <link />
tag is used to create a link in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
rel | string | The link relationship |
href | string | The link URL |
crossOrigin | string | The link cross origin |
Example
<ol />
The <ol />
tag is used to create an ordered list in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
dir | string | The list direction |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
type | string | The list type |
children | JSX.ElementChildren | The list items |
Example
<p />
The <p />
tag is used to create a paragraph in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
dir | string | The text direction |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
type | string | The text type |
children | JSX.ElementChildren | The paragraph text |
Example
<span />
The <span />
tag is used to create a span in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The span text |
Example
<strong />
The <strong />
tag is used to create a bold text in your email. It is compiled to the <b />
tag.
So look at the <b />
tag here.
<title />
The <title />
tag is used to create the title of your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
children | JSX.ElementChildren | The title text |
Example
<ul />
The <ul />
tag is used to create an unordered list in your email. It accepts the following props:
Prop | Type | Description |
---|---|---|
className | string | Some class to the result HTML |
dir | string | The list direction |
id | string | Some ID to the result HTML |
style | JSX.ElementStyle | Some style to the result HTML see more here |
children | JSX.ElementChildren | The list items |
Example
That’s it! Now you can create your email template using JSX Mail.