5
Sponsor

Category Preview

Category Preview rendered with email-safe, renderer-native components.

import { CategoryPreview } from "@/components/email/category-preview";
import { defaultTheme } from "@/components/email/theme-default";

export function CategoryPreviewDemo() {
  return (
    <CategoryPreview
      layout="cards"
      detailLevel="name"
      theme={{ ...defaultTheme, containerWidth: "640px" }}
    />
  );
}

Installation

$ pnpm dlx shadcn@latest add @emailcn/jsx-email/category-preview

Usage

import { CategoryPreview } from "@/components/email/category-preview";
<CategoryPreview layout="cards" detailLevel="name" />

Examples

Category preview with cards

basic

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelNameExampleDemo() {
  return <CategoryPreview layout="cards" detailLevel="name" />;
}

with header

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelNameHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="cards"
      detailLevel="name"
      header={{ heading: "Our products" }}
    />
  );
}

with description

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelDescriptionExampleDemo() {
  return <CategoryPreview layout="cards" detailLevel="description" />;
}

with details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelPriceExampleDemo() {
  return <CategoryPreview layout="cards" detailLevel="price" />;
}

full details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelFullExampleDemo() {
  return <CategoryPreview layout="cards" detailLevel="full" />;
}

header description

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelDescriptionHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="cards"
      detailLevel="description"
      header={{ heading: "Our products" }}
    />
  );
}

header details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelPriceHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="cards"
      detailLevel="price"
      header={{ heading: "Our products" }}
    />
  );
}

header full details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutCardsDetailLevelFullHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="cards"
      detailLevel="full"
      header={{ heading: "Our products" }}
    />
  );
}

Category preview with rows

basic

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelNameExampleDemo() {
  return <CategoryPreview layout="rows" detailLevel="name" />;
}

with header

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelNameHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="rows"
      detailLevel="name"
      header={{ heading: "Our products" }}
    />
  );
}

with description

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelDescriptionExampleDemo() {
  return <CategoryPreview layout="rows" detailLevel="description" />;
}

with details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelPriceExampleDemo() {
  return <CategoryPreview layout="rows" detailLevel="price" />;
}

full details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelFullExampleDemo() {
  return <CategoryPreview layout="rows" detailLevel="full" />;
}

header description

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelDescriptionHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="rows"
      detailLevel="description"
      header={{ heading: "Our products" }}
    />
  );
}

header details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelPriceHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="rows"
      detailLevel="price"
      header={{ heading: "Our products" }}
    />
  );
}

header full details

import { CategoryPreview } from "@/components/email/category-preview";

export function CategoryPreviewLayoutRowsDetailLevelFullHeaderExampleDemo() {
  return (
    <CategoryPreview
      layout="rows"
      detailLevel="full"
      header={{ heading: "Our products" }}
    />
  );
}

API Reference

PropTypeDefaultDescription
themeEmailThemedefaultThemeRenderer theme configuration.
layout"cards" | "rows""cards"Configures the component's layout.
detailLevel"name" | "description" | "price" | "full""name"Configures the component's detaillevel.
header{ heading: string; description?: string }-Configures the component's header.
itemsArray<{ image: { src: string; alt?: string }; name: string; price?: string; description?: string }>-Configures the component's items.
actionLabelstring-Configures the component's actionlabel.