5
Sponsor

Background

Background Call To Action rendered with email-safe, renderer-native components.

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";
import { defaultTheme } from "@/components/email/theme-default";

export function BackgroundCallToActionDemo() {
  return (
    <BackgroundCallToAction
      width="flush"
      appearance="light"
      theme={{ ...defaultTheme, containerWidth: "640px" }}
    />
  );
}

Installation

$ pnpm dlx shadcn@latest add @emailcn/mjml-react/background-call-to-action

Usage

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";
<BackgroundCallToAction width="flush" appearance="light" />

Examples

CTA with background image

flush

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionWidthFlushAppearanceLightExampleDemo() {
  return <BackgroundCallToAction width="flush" appearance="light" />;
}

boxed

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardFalseWidthBoxedAppearanceLightExampleDemo() {
  return (
    <BackgroundCallToAction
      contentCard={false}
      width="boxed"
      appearance="light"
    />
  );
}

padded

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardFalseWidthPaddedAppearanceLightExampleDemo() {
  return (
    <BackgroundCallToAction
      contentCard={false}
      width="padded"
      appearance="light"
    />
  );
}

Boxed CTA with background image

flush light

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardWidthFlushAppearanceLightExampleDemo() {
  return (
    <BackgroundCallToAction contentCard width="flush" appearance="light" />
  );
}

flush dark

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardWidthFlushAppearanceDarkExampleDemo() {
  return <BackgroundCallToAction contentCard width="flush" appearance="dark" />;
}

padded light

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardWidthPaddedAppearanceLightExampleDemo() {
  return (
    <BackgroundCallToAction contentCard width="padded" appearance="light" />
  );
}

padded dark

import { BackgroundCallToAction } from "@/components/email/background-call-to-action";

export function BackgroundCallToActionContentCardWidthPaddedAppearanceDarkExampleDemo() {
  return (
    <BackgroundCallToAction contentCard width="padded" appearance="dark" />
  );
}

API Reference

PropTypeDefaultDescription
themeEmailThemedefaultThemeRenderer theme configuration.
headingstring"Welcome to Your Workspace"Configures the component's heading.
descriptionstring-Configures the component's description.
emphasisstring-Configures the component's emphasis.
actionsArray<{ href: string; label: string }>-Configures the component's actions.
backgroundImage{ src: string; alt?: string }-Configures the component's backgroundimage.
width"flush" | "boxed" | "padded""flush"Configures the component's width.
contentCardbooleanfalseConfigures the component's contentcard.
appearance"light" | "dark""light"Configures the component's appearance.