1 ---
2 sidebar_label: "Product Table Cells"
3 ---
4
5 import { TypeList } from "docs-ui"
6
7 export const metadata = {
8 title: `Product Table Cells - Admin Components`,
9 }
10
11 # {metadata.title}
12
13 <Note>
14
15 These components are available since Medusa [v2.21.0](https://github.com/medusajs/medusa/releases/tag/v2.21.0).
16
17 </Note>
18
19 The product table cells render a product's data in a [data table](!ui!/components/data-table) column the same way the Medusa Admin does. The Medusa Admin uses them in its products list and in the tables that let the user pick items when creating an order edit, return, or claim.
20
21 ```tsx
22 import {
23 ProductCell,
24 ProductHeader,
25 } from "@medusajs/dashboard/components"
26 ```
27
28 Each cell has a matching header component that renders the column's translated label. The header components accept no props.
29
30 ---
31
32 ## Example
33
34 Pass a header component to a column's `header` and a cell component to its `cell`:
35
36 ```tsx title="src/admin/routes/products/page.tsx"
37 import {
38 DataTable,
39 ProductCell,
40 ProductHeader,
41 ProductStatusCell,
42 ProductStatusHeader,
43 } from "@medusajs/dashboard/components"
44 import { createDataTableColumnHelper } from "@medusajs/ui"
45
46 const columnHelper = createDataTableColumnHelper()
47
48 const columns = [
49 columnHelper.display({
50 id: "product",
51 header: () => <ProductHeader />,
52 cell: ({ row }) => (
53 <ProductCell product={row.original} />
54 ),
55 }),
56 columnHelper.accessor("status", {
57 header: () => <ProductStatusHeader />,
58 cell: ({ row }) => (
59 <ProductStatusCell status={row.original.status} />
60 ),
61 }),
62 ]
63 ```
64
65 Every cell renders a placeholder when its value is missing or empty, except for `ProductCell`, which always renders a thumbnail and a title.
66
67 ---
68
69 ## ProductCell
70
71 Shows a product's thumbnail next to its title. The title truncates when it doesn't fit the cell.
72
73 <TypeList
74 types={[
75 {
76 name: "product",
77 type: `\`Pick<AdminProduct, "thumbnail" | "title">\``,
78 optional: false,
79 description: "The product to show. It only needs the `thumbnail` and `title` properties.",
80 },
81 ]}
82 />
83
84 `ProductHeader` renders the "Product" label and accepts no props.
85
86 ---
87
88 ## ProductStatusCell
89
90 Shows a product's status as a colored status indicator. It renders a placeholder when the status isn't one of the four product statuses.
91
92 <TypeList
93 types={[
94 {
95 name: "status",
96 type: "`AdminProductStatus`",
97 optional: true,
98 description: "The product's status. The cell shows `draft` in grey, `proposed` in orange, `published` in green, and `rejected` in red.",
99 },
100 ]}
101 />
102
103 `ProductStatusHeader` renders the "Status" label and accepts no props.
104
105 ---
106
107 ## SalesChannelsCell
108
109 Shows the names of the sales channels that a product is available in. If there are more than two, the cell shows the first two and a tooltip listing the rest.
110
111 <TypeList
112 types={[
113 {
114 name: "salesChannels",
115 type: "`SalesChannelDTO[]` \\| `null`",
116 optional: true,
117 description: "The sales channels to show. The cell ignores empty entries and renders a placeholder when the list is empty.",
118 },
119 ]}
120 />
121
122 `SalesChannelHeader` renders the "Sales Channels" label and accepts no props.
123
124 ---
125
126 ## VariantCell
127
128 Shows the number of a product's variants, such as "3 variants".
129
130 <TypeList
131 types={[
132 {
133 name: "variants",
134 type: "`AdminProductVariant[]` \\| `null`",
135 optional: true,
136 description: "The product's variants. The cell renders a placeholder when the list is empty.",
137 },
138 ]}
139 />
140
141 `VariantHeader` renders the "Variants" label and accepts no props.
142
143 ---
144
145 ## Related Components
146
147 - [Data Table](../../guides/data-table/page.mdx): how to build a data table that fetches its records from the Medusa backend.
148 - [Thumbnail](../thumbnail/page.mdx): the component that `ProductCell` uses to show a product's thumbnail.