Skip to content

Button

An Email Craft component which styles an anchor element to appear as a button

TIP

Semantics: Quite often in the email world we talk about buttons when we actually mean links. Behind the scenes this component is a <a> element which is styled like a <button> element.

Install

Install the component from your command line

console
pnpm install email-craft
pnpm install email-craft
console
bun install email-craft
bun install email-craft
console
npm install email-craft
npm install email-craft
console
yarn install email-craft
yarn install email-craft

Usage

Add the component to your email template. Include styles where needed.

jsx
import { Button } from 'email-craft';

const Email = () => {
  return (
    <Button href="https://example.com" style={{ color: '#61dafb', padding: '10px 20px' }}>
      Click me
    </Button>
  );
};
import { Button } from 'email-craft';

const Email = () => {
  return (
    <Button href="https://example.com" style={{ color: '#61dafb', padding: '10px 20px' }}>
      Click me
    </Button>
  );
};

Component Props

ts
href: string;
href: string;

The url to navigate to when the button is clicked.

ts
target?: string;
target?: string;

Specifies the value of the "target" attribute for the button target.

TIP

This component also expresses all of the Common Component Props for ComponentProps<'a'>.