Skip to content

These components handle text rendering and other common content elements. They are imported from hono-email:

import {
Text,
Heading,
Link,
Button,
Img,
Hr,
CodeInline,
CodeBlock,
List,
ListItem,
} from 'hono-email'

Paragraph element with email-friendly defaults.

Defaults: font-size: 14px, line-height: 24px, margin: 16px 0

Accepts all standard <p> attributes and style to override defaults.

<Text style={{ color: '#374151', fontSize: '16px' }}>Thanks for signing up.</Text>

Heading element with shorthand margin props.

<Heading as="h2" mt={0} mb={16}>
Account summary
</Heading>

Type: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' · Default: 'h1'

Margin shorthands Optional

Section titled “Margin shorthands ”

m, mx, my, mt, mr, mb, ml — shorthand margin props. Numbers are converted to pixels.

Anchor element. Requires href.

<Link href="https://example.com/account">View your account</Link>

Type: string

Type: string · Default: '_blank'

Call-to-action link rendered with Outlook-compatible button padding.

<Button
href="https://example.com/confirm"
style={{
backgroundColor: '#111827',
color: '#ffffff',
padding: '12px 24px',
borderRadius: '6px',
}}
>
Confirm your email
</Button>

Type: string

Type: string · Default: '_blank'

Image element. src and alt are both required.

<Img src="https://example.com/logo.png" alt="Company Logo" width={120} height={40} />

Type: string

Type: string

Descriptive alt text for accessibility and clients that block images.

Horizontal rule.

Default: border-top: 1px solid #eaeaea, width: 100%

<Text>Order details</Text>
<Hr />
<Text>Total: $42.00</Text>

Inline code span.

Defaults: font-family: monospace, background: #f3f4f6, font-size: 13px, padding: 2px 4px

<Text>
Run <CodeInline>npm install hono-email</CodeInline> to get started.
</Text>

Preformatted code block.

Defaults: font-family: monospace, background: #f3f4f6, font-size: 13px, white-space: pre-wrap

<CodeBlock>{`curl -X POST https://api.example.com/send`}</CodeBlock>

Ordered or unordered lists.

<List ordered>
<ListItem>Confirm your email address</ListItem>
<ListItem>Set up your profile</ListItem>
<ListItem>Invite your team</ListItem>
</List>

Type: boolean

Render an <ol> when true, <ul> otherwise.

Type: string

CSS list-style-type value (e.g. 'disc', 'decimal', '"→ "').