|
1
|
--- |
|
2
|
sidebar_label: "Section Row" |
|
3
|
--- |
|
4
|
|
|
5
|
import { TypeList } from "docs-ui" |
|
6
|
|
|
7
|
export const metadata = { |
|
8
|
title: `SectionRow - Admin Components`, |
|
9
|
} |
|
10
|
|
|
11
|
# {metadata.title} |
|
12
|
|
|
13
|
<Note> |
|
14
|
|
|
15
|
This component is available since Medusa [v2.21.0](https://github.com/medusajs/medusa/releases/tag/v2.21.0). |
|
16
|
|
|
17
|
</Note> |
|
18
|
|
|
19
|
The `SectionRow` component shows a title and its value side by side in a row. The Medusa Admin uses it in the detail sections of its pages, such as a product's general section. |
|
20
|
|
|
21
|
```tsx |
|
22
|
import { SectionRow } from "@medusajs/dashboard/components" |
|
23
|
``` |
|
24
|
|
|
25
|
--- |
|
26
|
|
|
27
|
## Example |
|
28
|
|
|
29
|
Use `SectionRow` inside a container in a [widget](!docs!/learn/fundamentals/admin/widgets) or [UI route](!docs!/learn/fundamentals/admin/ui-routes): |
|
30
|
|
|
31
|
```tsx |
|
32
|
import { SectionRow } from "@medusajs/dashboard/components" |
|
33
|
import { Container, Heading } from "@medusajs/ui" |
|
34
|
|
|
35
|
const BrandGeneralSection = ({ brand }) => { |
|
36
|
return ( |
|
37
|
<Container className="divide-y p-0"> |
|
38
|
<div className="px-6 py-4"> |
|
39
|
<Heading level="h2">Brand</Heading> |
|
40
|
</div> |
|
41
|
<SectionRow title="Name" value={brand.name} /> |
|
42
|
<SectionRow title="Handle" value={brand.handle} /> |
|
43
|
</Container> |
|
44
|
) |
|
45
|
} |
|
46
|
``` |
|
47
|
|
|
48
|
Medusa shows a dash when you pass an empty `value`. |
|
49
|
|
|
50
|
--- |
|
51
|
|
|
52
|
## Props |
|
53
|
|
|
54
|
The component accepts the `SectionRowProps` type: |
|
55
|
|
|
56
|
<TypeList |
|
57
|
types={[ |
|
58
|
{ |
|
59
|
name: "title", |
|
60
|
type: "`string`", |
|
61
|
optional: false, |
|
62
|
description: `The row's title, shown in the first column.`, |
|
63
|
}, |
|
64
|
{ |
|
65
|
name: "value", |
|
66
|
type: "`React.ReactNode` \\| `string` \\| `null`", |
|
67
|
optional: true, |
|
68
|
description: `The row's value. Medusa shows a dash when the value is empty. When you pass a React node instead of a string, Medusa wraps it in a flex container that wraps its items, which is useful for badges or lists.`, |
|
69
|
}, |
|
70
|
{ |
|
71
|
name: "actions", |
|
72
|
type: "`React.ReactNode`", |
|
73
|
optional: true, |
|
74
|
description: `Content to show at the end of the row, such as an [ActionMenu](../action-menu/page.mdx). When you pass it, Medusa adds a third column for the content.`, |
|
75
|
}, |
|
76
|
]} |
|
77
|
/> |