1 ---
2 sidebar_label: "Listicle"
3 ---
4
5 import { TypeList } from "docs-ui"
6
7 export const metadata = {
8 title: `Listicle - 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 `Listicle` component shows a single card-styled list item with a label, a description, and an optional trailing element such as an action menu. The Medusa Admin uses it to list a customer's addresses in the customer details page.
20
21 ```tsx
22 import { Listicle } from "@medusajs/dashboard/components"
23 ```
24
25 ---
26
27 ## Example
28
29 Show a list of addresses in a widget, each with a delete action:
30
31 ```tsx
32 import { defineWidgetConfig } from "@medusajs/admin-sdk"
33 import {
34 ActionMenu,
35 Listicle,
36 } from "@medusajs/dashboard/components"
37 import { Trash } from "@medusajs/icons"
38 import { Container, Heading } from "@medusajs/ui"
39 import { useTranslation } from "react-i18next"
40
41 const AddressesWidget = () => {
42 const { t } = useTranslation()
43 const addresses = [
44 { id: "addr_1", name: "Home", street: "1 Main St" },
45 ]
46
47 return (
48 <Container className="p-0">
49 <Heading level="h2" className="px-6 py-4">
50 Addresses
51 </Heading>
52 {addresses.map((address) => (
53 <Listicle
54 key={address.id}
55 labelKey={address.name}
56 descriptionKey={address.street}
57 >
58 <ActionMenu
59 groups={[
60 {
61 actions: [
62 {
63 icon: <Trash />,
64 label: t("actions.delete"),
65 onClick: () => {},
66 },
67 ],
68 },
69 ]}
70 />
71 </Listicle>
72 ))}
73 </Container>
74 )
75 }
76
77 export const config = defineWidgetConfig({
78 zone: "customer.details.after",
79 })
80
81 export default AddressesWidget
82 ```
83
84 ---
85
86 ## Translations
87
88 The `labelKey` and `descriptionKey` props are named after the translation keys that the Medusa Admin passes to them, but the component renders their values as they are. So, translate the values before passing them to the component using the `t` function of the `useTranslation` hook from `react-i18next`:
89
90 ```tsx
91 import { useTranslation } from "react-i18next"
92
93 const { t } = useTranslation()
94
95 return (
96 <Listicle
97 labelKey={t("stockLocations.sidebar.label")}
98 descriptionKey={t(
99 "stockLocations.sidebar.description"
100 )}
101 />
102 )
103 ```
104
105 Learn more about translations and how to add your own keys in the [Admin Translations](!docs!/learn/fundamentals/admin/translations) documentation.
106
107 ---
108
109 ## Props
110
111 <TypeList
112 types={[
113 {
114 name: "labelKey",
115 type: "`string`",
116 optional: false,
117 description: `The item's label, shown as the card's title.`,
118 },
119 {
120 name: "descriptionKey",
121 type: "`string`",
122 optional: false,
123 description: `The item's description, shown under the label.`,
124 },
125 {
126 name: "children",
127 type: "`React.ReactNode`",
128 optional: true,
129 description: `An element shown at the end of the item, such as an [ActionMenu](../action-menu/page.mdx).`,
130 },
131 ]}
132 />
133
134 The `ListicleProps` type is also exported, so you can use it to type your own wrapper components:
135
136 ```tsx
137 import type {
138 ListicleProps,
139 } from "@medusajs/dashboard/components"
140 ```