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
| Prop | Type | Default | Description |
|---|---|---|---|
theme | EmailTheme | defaultTheme | Renderer 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. |
items | Array<{ image: { src: string; alt?: string }; name: string; price?: string; description?: string }> | - | Configures the component's items. |
actionLabel | string | - | Configures the component's actionlabel. |
On This Page
InstallationUsageExamplesCategory preview with cardsbasicwith headerwith descriptionwith detailsfull detailsheader descriptionheader detailsheader full detailsCategory preview with rowsbasicwith headerwith descriptionwith detailsfull detailsheader descriptionheader detailsheader full detailsAPI Reference