Installation
Usage
Add the component to your email template.Props
The code string to display
The programming language for syntax highlighting (e.g.,
"javascript", "typescript", "python", "html", etc.)The theme object for styling. Import built-in themes from
@react-email/code-block like dracula, github, monokai, etc.Whether to display line numbers beside each code line
Override the font family for the code block. Useful when using a global font with the
<Font> componentAdditional inline styles for the pre element
Theming
Themes for this component are a set of styles for each kind of token that results from Prism.js’s tokenization. An example theme structure:Built-in Themes
The package includes several pre-built themes that you can import:draculagithubmonokai- And more…
TypeScript
Email Client Support
This component was tested using the most popular email clients.| Gmail | Apple Mail | Outlook | Yahoo! Mail | HEY | Superhuman |
|---|---|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |