Installation
$ pnpm dlx shadcn@latest add @mcpcn/product-list
Usage
import { ProductList, ProductListContent } from "@/components/ui/product-list";<ProductList>
<ProductListContent />
</ProductList>Composition
Use the following composition to build an ProductList:
ProductList
└── ProductListContentExamples
Grid
"use client";
import { ProductList, ProductListContent } from "@/components/ui/product-list";
export function ProductListGridDemo() {
return (
<ProductList appearance={{ variant: "grid" }}>
<ProductListContent />
</ProductList>
);
}Carousel
"use client";
import { ProductList, ProductListContent } from "@/components/ui/product-list";
export function ProductListCarouselDemo() {
return (
<ProductList appearance={{ variant: "carousel" }}>
<ProductListContent />
</ProductList>
);
}Picker
| Product | Price | |
|---|---|---|
Air Force 1 '07 Nike | €119 | |
Air Max 90 Nike | €140 | |
Air Max Plus Nike | €170 €190 | |
Dunk Low Nike | €115 |
"use client";
import { ProductList, ProductListContent } from "@/components/ui/product-list";
export function ProductListPickerDemo() {
return (
<ProductList appearance={{ variant: "picker" }}>
<ProductListContent />
</ProductList>
);
}OpenUI Integration
Install the OpenUI React packages.
pnpm add @openuidev/react-lang zodAdd ProductList to a component library and map it to the installed component.
import { createLibrary, defineComponent } from "@openuidev/react-lang";
import { z } from "zod/v4";
import { ProductList, ProductListContent } from "@/components/ui/product-list";
const OpenUIProductList = defineComponent({
name: "ProductList",
description: "Product list with list, grid, carousel, and picker variants.",
props: z.object({}),
component: () => (
<ProductList>
<ProductListContent />
</ProductList>
),
});
export const product_listLibrary = createLibrary({
root: "ProductList",
components: [OpenUIProductList],
});For richer generated compositions, define the child primitives separately and connect them with .ref fields. See Defining Components in the OpenUI documentation.
json-render Integration
Install the json-render React packages.
pnpm add @json-render/core @json-render/react zodAdd ProductList to a component catalog and map it to the installed component.
import { defineCatalog } from "@json-render/core";
import { defineRegistry } from "@json-render/react";
import { schema } from "@json-render/react/schema";
import { z } from "zod";
import { ProductList, ProductListContent } from "@/components/ui/product-list";
export const catalog = defineCatalog(schema, {
components: {
ProductList: {
props: z.object({}),
description:
"Product list with list, grid, carousel, and picker variants.",
},
},
});
export const { registry } = defineRegistry(catalog, {
components: {
ProductList: () => (
<ProductList>
<ProductListContent />
</ProductList>
),
},
});Use catalog.prompt() to constrain model output, then render the generated spec with the json-render React Renderer. See the json-render Quick Start for the provider and streaming setup.
API Reference
See the Base UI documentation for more information.