@abraracs/better-shopify-wc-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +325 -0
- package/docs/avatar.md +481 -0
- package/docs/badge.md +266 -0
- package/docs/banner.md +350 -0
- package/docs/box.md +618 -0
- package/docs/button.md +604 -0
- package/docs/buttongroup.md +251 -0
- package/docs/checkbox.md +346 -0
- package/docs/chip.md +261 -0
- package/docs/choicelist.md +416 -0
- package/docs/clickable.md +703 -0
- package/docs/clickablechip.md +377 -0
- package/docs/colorfield.md +416 -0
- package/docs/colorpicker.md +152 -0
- package/docs/datefield.md +706 -0
- package/docs/datepicker.md +443 -0
- package/docs/divider.md +263 -0
- package/docs/dropzone.md +331 -0
- package/docs/emailfield.md +377 -0
- package/docs/grid.md +1246 -0
- package/docs/heading.md +201 -0
- package/docs/icon.md +295 -0
- package/docs/image.md +517 -0
- package/docs/link.md +456 -0
- package/docs/menu.md +331 -0
- package/docs/modal.md +640 -0
- package/docs/moneyfield.md +385 -0
- package/docs/numberfield.md +393 -0
- package/docs/orderedlist.md +224 -0
- package/docs/page.md +319 -0
- package/docs/paragraph.md +333 -0
- package/docs/passwordfield.md +381 -0
- package/docs/popover.md +419 -0
- package/docs/querycontainer.md +121 -0
- package/docs/searchfield.md +319 -0
- package/docs/section.md +267 -0
- package/docs/select.md +449 -0
- package/docs/spinner.md +121 -0
- package/docs/stack.md +748 -0
- package/docs/switch.md +365 -0
- package/docs/table.md +805 -0
- package/docs/text.md +339 -0
- package/docs/textarea.md +328 -0
- package/docs/textfield.md +425 -0
- package/docs/thumbnail.md +245 -0
- package/docs/tooltip.md +130 -0
- package/docs/unorderedlist.md +135 -0
- package/docs/urlfield.md +314 -0
- package/package.json +43 -0
package/docs/badge.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Badge
|
|
3
|
+
description: >-
|
|
4
|
+
Inform users about the status of an object or indicate that an action has been
|
|
5
|
+
completed.
|
|
6
|
+
api_name: app-home
|
|
7
|
+
source_url:
|
|
8
|
+
html: >-
|
|
9
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/titles-and-text/badge
|
|
10
|
+
md: >-
|
|
11
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/titles-and-text/badge.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Badge
|
|
15
|
+
|
|
16
|
+
Inform users about the status of an object or indicate that an action has been completed.
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
* color
|
|
21
|
+
|
|
22
|
+
"base" | "strong"
|
|
23
|
+
|
|
24
|
+
Default: 'base'
|
|
25
|
+
|
|
26
|
+
Modify the color to be more or less intense.
|
|
27
|
+
|
|
28
|
+
* icon
|
|
29
|
+
|
|
30
|
+
"" | "replace" | "search" | "split" | "link" | "edit" | "product" | "variant" | "collection" | "select" | "info" | "incomplete" | "complete" | "color" | "money" | "adjust" | "affiliate" | "airplane" | "alert-bubble" | "alert-circle" | "alert-diamond" | "alert-location" | "alert-octagon" | "alert-octagon-filled" | "alert-triangle" | "alert-triangle-filled" | "app-extension" | "apps" | "archive" | "arrow-down" | "arrow-down-circle" | "arrow-down-right" | "arrow-left" | "arrow-left-circle" | "arrow-right" | "arrow-right-circle" | "arrow-up" | "arrow-up-circle" | "arrow-up-right" | "arrows-in-horizontal" | "arrows-out-horizontal" | "asterisk" | "attachment" | "automation" | "backspace" | "bag" | "bank" | "barcode" | "battery-low" | "bill" | "blank" | "blog" | "bolt" | "bolt-filled" | "book" | "book-open" | "bug" | "bullet" | "business-entity" | "button" | "button-press" | "calculator" | "calendar" | "calendar-check" | "calendar-compare" | "calendar-list" | "calendar-time" | "camera" | "camera-flip" | "caret-down" | "caret-left" | "caret-right" | "caret-up" | "cart" | "cart-abandoned" | "cart-discount" | "cart-down" | "cart-filled" | "cart-sale" | "cart-send" | "cart-up" | "cash-dollar" | "cash-euro" | "cash-pound" | "cash-rupee" | "cash-yen" | "catalog-product" | "categories" | "channels" | "chart-cohort" | "chart-donut" | "chart-funnel" | "chart-histogram-first" | "chart-histogram-first-last" | "chart-histogram-flat" | "chart-histogram-full" | "chart-histogram-growth" | "chart-histogram-last" | "chart-histogram-second-last" | "chart-horizontal" | "chart-line" | "chart-popular" | "chart-stacked" | "chart-vertical" | "chat" | "chat-new" | "chat-referral" | "check" | "check-circle" | "check-circle-filled" | "checkbox" | "chevron-down" | "chevron-down-circle" | "chevron-left" | "chevron-left-circle" | "chevron-right" | "chevron-right-circle" | "chevron-up" | "chevron-up-circle" | "circle" | "circle-dashed" | "clipboard" | "clipboard-check" | "clipboard-checklist" | "clock" | "clock-list" | "clock-revert" | "code" | "code-add" | "collection-featured" | "collection-list" | "collection-reference" | "color-none" | "compass" | "compose" | "confetti" | "connect" | "content" | "contract" | "corner-pill" | "corner-round" | "corner-square" | "credit-card" | "credit-card-cancel" | "credit-card-percent" | "credit-card-reader" | "credit-card-reader-chip" | "credit-card-reader-tap" | "credit-card-secure" | "credit-card-tap-chip" | "crop" | "currency-convert" | "cursor" | "cursor-banner" | "cursor-option" | "data-presentation" | "data-table" | "database" | "database-add" | "database-connect" | "delete" | "delivered" | "delivery" | "desktop" | "disabled" | "disabled-filled" | "discount" | "discount-add" | "discount-automatic" | "discount-code" | "discount-remove" | "dns-settings" | "dock-floating" | "dock-side" | "domain" | "domain-landing-page" | "domain-new" | "domain-redirect" | "download" | "drag-drop" | "drag-handle" | "drawer" | "duplicate" | "email" | "email-follow-up" | "email-newsletter" | "empty" | "enabled" | "enter" | "envelope" | "envelope-soft-pack" | "eraser" | "exchange" | "exit" | "export" | "external" | "eye-check-mark" | "eye-dropper" | "eye-dropper-list" | "eye-first" | "eyeglasses" | "fav" | "favicon" | "file" | "file-list" | "filter" | "filter-active" | "flag" | "flip-horizontal" | "flip-vertical" | "flower" | "folder" | "folder-add" | "folder-down" | "folder-remove" | "folder-up" | "food" | "foreground" | "forklift" | "forms" | "games" | "gauge" | "geolocation" | "gift" | "gift-card" | "git-branch" | "git-commit" | "git-repository" | "globe" | "globe-asia" | "globe-europe" | "globe-lines" | "globe-list" | "graduation-hat" | "grid" | "hashtag" | "hashtag-decimal" | "hashtag-list" | "heart" | "hide" | "hide-filled" | "home" | "home-filled" | "icons" | "identity-card" | "image" | "image-add" | "image-alt" | "image-explore" | "image-magic" | "image-none" | "image-with-text-overlay" | "images" | "import" | "in-progress" | "incentive" | "incoming" | "info-filled" | "inheritance" | "inventory" | "inventory-edit" | "inventory-list" | "inventory-transfer" | "inventory-updated" | "iq" | "key" | "keyboard" | "keyboard-filled" | "keyboard-hide" | "keypad" | "label-printer" | "language" | "language-translate" | "layout-block" | "layout-buy-button" | "layout-buy-button-horizontal" | "layout-buy-button-vertical" | "layout-column-1" | "layout-columns-2" | "layout-columns-3" | "layout-footer" | "layout-header" | "layout-logo-block" | "layout-popup" | "layout-rows-2" | "layout-section" | "layout-sidebar-left" | "layout-sidebar-right" | "lightbulb" | "link-list" | "list-bulleted" | "list-bulleted-filled" | "list-numbered" | "live" | "live-critical" | "live-none" | "location" | "location-none" | "lock" | "map" | "markets" | "markets-euro" | "markets-rupee" | "markets-yen" | "maximize" | "measurement-size" | "measurement-size-list" | "measurement-volume" | "measurement-volume-list" | "measurement-weight" | "measurement-weight-list" | "media-receiver" | "megaphone" | "mention" | "menu" | "menu-filled" | "menu-horizontal" | "menu-vertical" | "merge" | "metafields" | "metaobject" | "metaobject-list" | "metaobject-reference" | "microphone" | "microphone-muted" | "minimize" | "minus" | "minus-circle" | "mobile" | "money-none" | "money-split" | "moon" | "nature" | "note" | "note-add" | "notification" | "number-one" | "order" | "order-batches" | "order-draft" | "order-filled" | "order-first" | "order-fulfilled" | "order-repeat" | "order-unfulfilled" | "orders-status" | "organization" | "outdent" | "outgoing" | "package" | "package-cancel" | "package-fulfilled" | "package-on-hold" | "package-reassign" | "package-returned" | "page" | "page-add" | "page-attachment" | "page-clock" | "page-down" | "page-heart" | "page-list" | "page-reference" | "page-remove" | "page-report" | "page-up" | "pagination-end" | "pagination-start" | "paint-brush-flat" | "paint-brush-round" | "paper-check" | "partially-complete" | "passkey" | "paste" | "pause-circle" | "payment" | "payment-capture" | "payout" | "payout-dollar" | "payout-euro" | "payout-pound" | "payout-rupee" | "payout-yen" | "person" | "person-add" | "person-exit" | "person-filled" | "person-list" | "person-lock" | "person-remove" | "person-segment" | "personalized-text" | "phablet" | "phone" | "phone-down" | "phone-down-filled" | "phone-in" | "phone-out" | "pin" | "pin-remove" | "plan" | "play" | "play-circle" | "plus" | "plus-circle" | "plus-circle-down" | "plus-circle-filled" | "plus-circle-up" | "point-of-sale" | "point-of-sale-register" | "price-list" | "print" | "product-add" | "product-cost" | "product-filled" | "product-list" | "product-reference" | "product-remove" | "product-return" | "product-unavailable" | "profile" | "profile-filled" | "question-circle" | "question-circle-filled" | "radio-control" | "receipt" | "receipt-dollar" | "receipt-euro" | "receipt-folded" | "receipt-paid" | "receipt-pound" | "receipt-refund" | "receipt-rupee" | "receipt-yen" | "receivables" | "redo" | "referral-code" | "refresh" | "remove-background" | "reorder" | "replay" | "reset" | "return" | "reward" | "rocket" | "rotate-left" | "rotate-right" | "sandbox" | "save" | "savings" | "scan-qr-code" | "search-add" | "search-list" | "search-recent" | "search-resource" | "send" | "settings" | "share" | "shield-check-mark" | "shield-none" | "shield-pending" | "shield-person" | "shipping-label" | "shipping-label-cancel" | "shopcodes" | "slideshow" | "smiley-happy" | "smiley-joy" | "smiley-neutral" | "smiley-sad" | "social-ad" | "social-post" | "sort" | "sort-ascending" | "sort-descending" | "sound" | "sports" | "star" | "star-circle" | "star-filled" | "star-half" | "star-list" | "status" | "status-active" | "stop-circle" | "store" | "store-import" | "store-managed" | "store-online" | "sun" | "table" | "table-masonry" | "tablet" | "target" | "tax" | "team" | "text" | "text-align-center" | "text-align-left" | "text-align-right" | "text-block" | "text-bold" | "text-color" | "text-font" | "text-font-list" | "text-grammar" | "text-in-columns" | "text-in-rows" | "text-indent" | "text-indent-remove" | "text-italic" | "text-quote" | "text-title" | "text-underline" | "text-with-image" | "theme" | "theme-edit" | "theme-store" | "theme-template" | "three-d-environment" | "thumbs-down" | "thumbs-up" | "tip-jar" | "toggle-off" | "toggle-on" | "transaction" | "transaction-fee-add" | "transaction-fee-dollar" | "transaction-fee-euro" | "transaction-fee-pound" | "transaction-fee-rupee" | "transaction-fee-yen" | "transfer" | "transfer-in" | "transfer-internal" | "transfer-out" | "truck" | "undo" | "unknown-device" | "unlock" | "upload" | "variant-list" | "video" | "video-list" | "view" | "viewport-narrow" | "viewport-short" | "viewport-tall" | "viewport-wide" | "wallet" | "wand" | "watch" | "wifi" | "work" | "work-list" | "wrench" | "x" | "x-circle" | "x-circle-filled"
|
|
31
|
+
|
|
32
|
+
The type of icon to be displayed in the badge.
|
|
33
|
+
|
|
34
|
+
* size
|
|
35
|
+
|
|
36
|
+
"base" | "large" | "large-100"
|
|
37
|
+
|
|
38
|
+
Default: 'base'
|
|
39
|
+
|
|
40
|
+
Adjusts the size.
|
|
41
|
+
|
|
42
|
+
* tone
|
|
43
|
+
|
|
44
|
+
"info" | "success" | "warning" | "critical" | "auto" | "neutral" | "caution"
|
|
45
|
+
|
|
46
|
+
Default: 'auto'
|
|
47
|
+
|
|
48
|
+
Sets the tone of the Badge, based on the intention of the information being conveyed.
|
|
49
|
+
|
|
50
|
+
## Slots
|
|
51
|
+
|
|
52
|
+
* children
|
|
53
|
+
|
|
54
|
+
HTMLElement
|
|
55
|
+
|
|
56
|
+
The content of the Badge.
|
|
57
|
+
|
|
58
|
+
Examples
|
|
59
|
+
|
|
60
|
+
### Examples
|
|
61
|
+
|
|
62
|
+
* #### Code
|
|
63
|
+
|
|
64
|
+
##### jsx
|
|
65
|
+
|
|
66
|
+
```jsx
|
|
67
|
+
<>
|
|
68
|
+
<s-badge>Fulfilled</s-badge>
|
|
69
|
+
<s-badge tone="info">Draft</s-badge>
|
|
70
|
+
<s-badge tone="success">Active</s-badge>
|
|
71
|
+
<s-badge tone="caution">Open</s-badge>
|
|
72
|
+
<s-badge tone="warning">On hold</s-badge>
|
|
73
|
+
<s-badge tone="critical">Action required</s-badge>
|
|
74
|
+
</>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
##### html
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<s-badge>Fulfilled</s-badge>
|
|
81
|
+
<s-badge tone="info">Draft</s-badge>
|
|
82
|
+
<s-badge tone="success">Active</s-badge>
|
|
83
|
+
<s-badge tone="caution">Open</s-badge>
|
|
84
|
+
<s-badge tone="warning">On hold</s-badge>
|
|
85
|
+
<s-badge tone="critical">Action required</s-badge>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
* #### Order status badges
|
|
89
|
+
|
|
90
|
+
##### Description
|
|
91
|
+
|
|
92
|
+
Demonstrates how different badge tones can visually represent various order fulfillment states, enabling merchants to quickly understand order progress at a glance.
|
|
93
|
+
|
|
94
|
+
##### jsx
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
<s-stack direction="inline" gap="base">
|
|
98
|
+
<s-badge tone="success">Fulfilled</s-badge>
|
|
99
|
+
<s-badge tone="warning">Partially fulfilled</s-badge>
|
|
100
|
+
<s-badge tone="neutral">Unfulfilled</s-badge>
|
|
101
|
+
<s-badge tone="critical">Cancelled</s-badge>
|
|
102
|
+
</s-stack>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
##### html
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<s-stack direction="inline" gap="base">
|
|
109
|
+
<s-badge tone="success">Fulfilled</s-badge>
|
|
110
|
+
<s-badge tone="warning">Partially fulfilled</s-badge>
|
|
111
|
+
<s-badge tone="neutral">Unfulfilled</s-badge>
|
|
112
|
+
<s-badge tone="critical">Cancelled</s-badge>
|
|
113
|
+
</s-stack>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
* #### Status indicators with icons
|
|
117
|
+
|
|
118
|
+
##### Description
|
|
119
|
+
|
|
120
|
+
Showcases how badges can incorporate both tones and icons to provide contextual information across different merchant scenarios, such as product management, inventory tracking, and payment status.
|
|
121
|
+
|
|
122
|
+
##### jsx
|
|
123
|
+
|
|
124
|
+
```jsx
|
|
125
|
+
<s-stack gap="base">
|
|
126
|
+
{/* Product status */}
|
|
127
|
+
<s-stack direction="inline" gap="base">
|
|
128
|
+
<s-badge tone="success" icon="view">
|
|
129
|
+
Active
|
|
130
|
+
</s-badge>
|
|
131
|
+
<s-badge tone="warning" icon="clock">
|
|
132
|
+
Scheduled
|
|
133
|
+
</s-badge>
|
|
134
|
+
<s-badge tone="critical">Archived</s-badge>
|
|
135
|
+
</s-stack>
|
|
136
|
+
|
|
137
|
+
{/* Inventory status */}
|
|
138
|
+
<s-stack direction="inline" gap="base">
|
|
139
|
+
<s-badge tone="success">In stock</s-badge>
|
|
140
|
+
<s-badge tone="warning" icon="alert-triangle">
|
|
141
|
+
Low stock
|
|
142
|
+
</s-badge>
|
|
143
|
+
<s-badge tone="critical">Out of stock</s-badge>
|
|
144
|
+
</s-stack>
|
|
145
|
+
</s-stack>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
##### html
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<s-stack gap="base">
|
|
152
|
+
<!-- Product status -->
|
|
153
|
+
<s-stack direction="inline" gap="base">
|
|
154
|
+
<s-badge tone="success" icon="view">Active</s-badge>
|
|
155
|
+
<s-badge tone="warning" icon="clock">Scheduled</s-badge>
|
|
156
|
+
<s-badge tone="critical">Archived</s-badge>
|
|
157
|
+
</s-stack>
|
|
158
|
+
|
|
159
|
+
<!-- Inventory status -->
|
|
160
|
+
<s-stack direction="inline" gap="base">
|
|
161
|
+
<s-badge tone="success">In stock</s-badge>
|
|
162
|
+
<s-badge tone="warning" icon="alert-triangle">Low stock</s-badge>
|
|
163
|
+
<s-badge tone="critical">Out of stock</s-badge>
|
|
164
|
+
</s-stack>
|
|
165
|
+
</s-stack>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
* #### Within table context
|
|
169
|
+
|
|
170
|
+
##### Description
|
|
171
|
+
|
|
172
|
+
Illustrates how badges can be seamlessly integrated into table layouts to provide quick, visually distinct status indicators for individual table rows.
|
|
173
|
+
|
|
174
|
+
##### jsx
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
<s-table>
|
|
178
|
+
<s-table-header-row>
|
|
179
|
+
<s-table-header>Order</s-table-header>
|
|
180
|
+
<s-table-header>Fulfillment</s-table-header>
|
|
181
|
+
<s-table-header>Payment</s-table-header>
|
|
182
|
+
</s-table-header-row>
|
|
183
|
+
<s-table-body>
|
|
184
|
+
<s-table-row>
|
|
185
|
+
<s-table-cell>#1001</s-table-cell>
|
|
186
|
+
<s-table-cell>
|
|
187
|
+
<s-badge tone="success">Fulfilled</s-badge>
|
|
188
|
+
</s-table-cell>
|
|
189
|
+
<s-table-cell>
|
|
190
|
+
<s-badge tone="success">Paid</s-badge>
|
|
191
|
+
</s-table-cell>
|
|
192
|
+
</s-table-row>
|
|
193
|
+
</s-table-body>
|
|
194
|
+
</s-table>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
##### html
|
|
198
|
+
|
|
199
|
+
```html
|
|
200
|
+
<s-table>
|
|
201
|
+
<s-table-header-row>
|
|
202
|
+
<s-table-header>Order</s-table-header>
|
|
203
|
+
<s-table-header>Fulfillment</s-table-header>
|
|
204
|
+
<s-table-header>Payment</s-table-header>
|
|
205
|
+
</s-table-header-row>
|
|
206
|
+
<s-table-body>
|
|
207
|
+
<s-table-row>
|
|
208
|
+
<s-table-cell>#1001</s-table-cell>
|
|
209
|
+
<s-table-cell>
|
|
210
|
+
<s-badge tone="success">Fulfilled</s-badge>
|
|
211
|
+
</s-table-cell>
|
|
212
|
+
<s-table-cell>
|
|
213
|
+
<s-badge tone="success">Paid</s-badge>
|
|
214
|
+
</s-table-cell>
|
|
215
|
+
</s-table-row>
|
|
216
|
+
</s-table-body>
|
|
217
|
+
</s-table>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
* #### Different sizes for emphasis
|
|
221
|
+
|
|
222
|
+
##### Description
|
|
223
|
+
|
|
224
|
+
Demonstrates the two available badge sizes for creating visual hierarchy.
|
|
225
|
+
|
|
226
|
+
##### jsx
|
|
227
|
+
|
|
228
|
+
```jsx
|
|
229
|
+
<s-stack direction="inline" gap="base">
|
|
230
|
+
<s-badge size="base">New</s-badge>
|
|
231
|
+
<s-badge size="large">Attention needed</s-badge>
|
|
232
|
+
</s-stack>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
##### html
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<s-stack direction="inline" gap="base">
|
|
239
|
+
<s-badge size="base">New</s-badge>
|
|
240
|
+
<s-badge size="large">Attention needed</s-badge>
|
|
241
|
+
</s-stack>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Useful for
|
|
245
|
+
|
|
246
|
+
* Communicating the state of an object
|
|
247
|
+
* Identifying objects that need attention or action
|
|
248
|
+
* Quickly scanning complex lists to find specific object states
|
|
249
|
+
|
|
250
|
+
## Best practices
|
|
251
|
+
|
|
252
|
+
* `base`: use in tables where many badges are displayed
|
|
253
|
+
* `large`: use when badge needs to stand out prominently
|
|
254
|
+
* Text truncates automatically, keep labels short to avoid truncation
|
|
255
|
+
* Badges are static indicators, not interactive or dismissible
|
|
256
|
+
* Use `critical` or `warning` tones for errors needing immediate attention
|
|
257
|
+
* Use consistent styles and icons for common statuses
|
|
258
|
+
* When using badges in line items, integrate them with the full content group rather than attaching only to the header
|
|
259
|
+
* Don't use badges for merchant-created information. Instead, use a Chip or ClickableChip
|
|
260
|
+
|
|
261
|
+
## Content guidelines
|
|
262
|
+
|
|
263
|
+
Badge labels should:
|
|
264
|
+
|
|
265
|
+
* Use 1-2 words maximum: `Fulfilled`, `Partially refunded`
|
|
266
|
+
* Always use past tense: `Refunded` not `Refund`
|
package/docs/banner.md
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Banner
|
|
3
|
+
description: >-
|
|
4
|
+
Highlights important information or required actions prominently within the
|
|
5
|
+
interface. Use to communicate statuses, provide feedback, or draw attention to
|
|
6
|
+
critical updates.
|
|
7
|
+
api_name: app-home
|
|
8
|
+
source_url:
|
|
9
|
+
html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/feedback/banner'
|
|
10
|
+
md: >-
|
|
11
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/feedback/banner.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Banner
|
|
15
|
+
|
|
16
|
+
Highlights important information or required actions prominently within the interface. Use to communicate statuses, provide feedback, or draw attention to critical updates.
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
* dismissible
|
|
21
|
+
|
|
22
|
+
boolean
|
|
23
|
+
|
|
24
|
+
Default: false
|
|
25
|
+
|
|
26
|
+
Determines whether the close button of the banner is present.
|
|
27
|
+
|
|
28
|
+
When the close button is pressed, the `dismiss` event will fire, then `hidden` will be true, any animation will complete, and the `afterhide` event will fire.
|
|
29
|
+
|
|
30
|
+
* heading
|
|
31
|
+
|
|
32
|
+
string
|
|
33
|
+
|
|
34
|
+
Default: ''
|
|
35
|
+
|
|
36
|
+
The title of the banner.
|
|
37
|
+
|
|
38
|
+
* hidden
|
|
39
|
+
|
|
40
|
+
boolean
|
|
41
|
+
|
|
42
|
+
Default: false
|
|
43
|
+
|
|
44
|
+
Determines whether the banner is hidden.
|
|
45
|
+
|
|
46
|
+
If this property is being set on each framework render (as in 'controlled' usage), and the banner is `dismissible`, ensure you update app state for this property when the `dismiss` event fires.
|
|
47
|
+
|
|
48
|
+
If the banner is not `dismissible`, it can still be hidden by setting this property.
|
|
49
|
+
|
|
50
|
+
* tone
|
|
51
|
+
|
|
52
|
+
"info" | "success" | "warning" | "critical" | "auto"
|
|
53
|
+
|
|
54
|
+
Default: 'auto'
|
|
55
|
+
|
|
56
|
+
Sets the tone of the Banner, based on the intention of the information being conveyed.
|
|
57
|
+
|
|
58
|
+
The banner is a live region and the type of status will be dictated by the Tone selected.
|
|
59
|
+
|
|
60
|
+
* `critical` creates an [assertive live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role) that is announced by screen readers immediately.
|
|
61
|
+
* `neutral`, `info`, `success`, `warning` and `caution` creates an [informative live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/status_role) that is announced by screen readers after the current message.
|
|
62
|
+
|
|
63
|
+
## Events
|
|
64
|
+
|
|
65
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
66
|
+
|
|
67
|
+
* afterhide
|
|
68
|
+
|
|
69
|
+
CallbackEventListener\<typeof tagName> | null
|
|
70
|
+
|
|
71
|
+
* dismiss
|
|
72
|
+
|
|
73
|
+
CallbackEventListener\<typeof tagName> | null
|
|
74
|
+
|
|
75
|
+
### CallbackEventListener
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
(EventListener & {
|
|
79
|
+
(event: CallbackEvent<T>): void;
|
|
80
|
+
}) | null
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### CallbackEvent
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
Event & {
|
|
87
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Slots
|
|
92
|
+
|
|
93
|
+
* children
|
|
94
|
+
|
|
95
|
+
HTMLElement
|
|
96
|
+
|
|
97
|
+
The content of the Banner.
|
|
98
|
+
|
|
99
|
+
* secondary-actions
|
|
100
|
+
|
|
101
|
+
HTMLElement
|
|
102
|
+
|
|
103
|
+
The secondary actions to display at the bottom of the Banner.
|
|
104
|
+
|
|
105
|
+
Only Buttons with the `variant` of "secondary" or "auto" are permitted. A maximum of two `s-button` components are allowed.
|
|
106
|
+
|
|
107
|
+
Examples
|
|
108
|
+
|
|
109
|
+
### Examples
|
|
110
|
+
|
|
111
|
+
* #### Code
|
|
112
|
+
|
|
113
|
+
##### jsx
|
|
114
|
+
|
|
115
|
+
```jsx
|
|
116
|
+
<s-banner heading="Order archived" tone="info" dismissible>
|
|
117
|
+
This order was archived on March 7, 2017 at 3:12pm EDT.
|
|
118
|
+
</s-banner>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
##### html
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<s-banner heading="Order archived" tone="info" dismissible>
|
|
125
|
+
This order was archived on March 7, 2017 at 3:12pm EDT.
|
|
126
|
+
</s-banner>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
* #### Basic information banner
|
|
130
|
+
|
|
131
|
+
##### Description
|
|
132
|
+
|
|
133
|
+
Demonstrates a simple informational banner used to communicate status updates or completed actions, providing clear and concise feedback to the user.
|
|
134
|
+
|
|
135
|
+
##### jsx
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
<s-banner heading="Order archived">
|
|
139
|
+
This order was archived on March 7, 2017 at 3:12pm EDT.
|
|
140
|
+
</s-banner>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
##### html
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<s-banner heading="Order archived">
|
|
147
|
+
This order was archived on March 7, 2017 at 3:12pm EDT.
|
|
148
|
+
</s-banner>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
* #### Warning banner with specific actions
|
|
152
|
+
|
|
153
|
+
##### Description
|
|
154
|
+
|
|
155
|
+
Illustrates a warning banner that highlights a potential issue and provides actionable buttons to help users resolve the problem quickly and effectively.
|
|
156
|
+
|
|
157
|
+
##### jsx
|
|
158
|
+
|
|
159
|
+
```jsx
|
|
160
|
+
<s-banner heading="127 products missing shipping weights" tone="warning">
|
|
161
|
+
Products without weights may show inaccurate shipping rates, leading to
|
|
162
|
+
checkout abandonment.
|
|
163
|
+
<s-button
|
|
164
|
+
slot="secondary-actions"
|
|
165
|
+
variant="secondary"
|
|
166
|
+
href="/admin/products?filter=missing-weights"
|
|
167
|
+
>
|
|
168
|
+
Review products
|
|
169
|
+
</s-button>
|
|
170
|
+
<s-button
|
|
171
|
+
slot="secondary-actions"
|
|
172
|
+
variant="secondary"
|
|
173
|
+
href="javascript:void(0)"
|
|
174
|
+
>
|
|
175
|
+
Setup guide
|
|
176
|
+
</s-button>
|
|
177
|
+
</s-banner>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
##### html
|
|
181
|
+
|
|
182
|
+
```html
|
|
183
|
+
<s-banner heading="127 products missing shipping weights" tone="warning">
|
|
184
|
+
Products without weights may show inaccurate shipping rates, leading to
|
|
185
|
+
checkout abandonment.
|
|
186
|
+
<s-button
|
|
187
|
+
slot="secondary-actions"
|
|
188
|
+
variant="secondary"
|
|
189
|
+
href="/admin/products?filter=missing-weights"
|
|
190
|
+
>
|
|
191
|
+
Review products
|
|
192
|
+
</s-button>
|
|
193
|
+
<s-button
|
|
194
|
+
slot="secondary-actions"
|
|
195
|
+
variant="secondary"
|
|
196
|
+
href="javascript:void(0)"
|
|
197
|
+
>
|
|
198
|
+
Setup guide
|
|
199
|
+
</s-button>
|
|
200
|
+
</s-banner>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
* #### Critical banner with clear next steps
|
|
204
|
+
|
|
205
|
+
##### Description
|
|
206
|
+
|
|
207
|
+
Demonstrates an urgent banner design that signals a critical issue requiring immediate action, with clear and prominent secondary action buttons to guide users.
|
|
208
|
+
|
|
209
|
+
##### jsx
|
|
210
|
+
|
|
211
|
+
```jsx
|
|
212
|
+
<s-banner heading="Order #1024 flagged for fraud review" tone="critical">
|
|
213
|
+
This order shows multiple risk indicators and cannot be auto-fulfilled. Review
|
|
214
|
+
required within 24 hours to prevent automatic cancellation.
|
|
215
|
+
<s-button
|
|
216
|
+
slot="secondary-actions"
|
|
217
|
+
variant="secondary"
|
|
218
|
+
href="/admin/orders/1024/risk"
|
|
219
|
+
>
|
|
220
|
+
Review order details
|
|
221
|
+
</s-button>
|
|
222
|
+
<s-button
|
|
223
|
+
slot="secondary-actions"
|
|
224
|
+
variant="secondary"
|
|
225
|
+
href="/admin/settings/payments/fraud"
|
|
226
|
+
>
|
|
227
|
+
Adjust fraud settings
|
|
228
|
+
</s-button>
|
|
229
|
+
</s-banner>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
##### html
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<s-banner heading="Order #1024 flagged for fraud review" tone="critical">
|
|
236
|
+
This order shows multiple risk indicators and cannot be auto-fulfilled. Review
|
|
237
|
+
required within 24 hours to prevent automatic cancellation.
|
|
238
|
+
<s-button
|
|
239
|
+
slot="secondary-actions"
|
|
240
|
+
variant="secondary"
|
|
241
|
+
href="/admin/orders/1024/risk"
|
|
242
|
+
>
|
|
243
|
+
Review order details
|
|
244
|
+
</s-button>
|
|
245
|
+
<s-button
|
|
246
|
+
slot="secondary-actions"
|
|
247
|
+
variant="secondary"
|
|
248
|
+
href="/admin/settings/payments/fraud"
|
|
249
|
+
>
|
|
250
|
+
Adjust fraud settings
|
|
251
|
+
</s-button>
|
|
252
|
+
</s-banner>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
* #### Dismissible success banner
|
|
256
|
+
|
|
257
|
+
##### Description
|
|
258
|
+
|
|
259
|
+
Success confirmation with dismiss option for completed operations.
|
|
260
|
+
|
|
261
|
+
##### jsx
|
|
262
|
+
|
|
263
|
+
```jsx
|
|
264
|
+
<s-banner heading="Products imported" tone="success" dismissible={true}>
|
|
265
|
+
Successfully imported 50 products to your store.
|
|
266
|
+
</s-banner>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
##### html
|
|
270
|
+
|
|
271
|
+
```html
|
|
272
|
+
<s-banner heading="Products imported" tone="success" dismissible="true">
|
|
273
|
+
Successfully imported 50 products to your store.
|
|
274
|
+
</s-banner>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
* #### Info banner with clear value proposition
|
|
278
|
+
|
|
279
|
+
##### Description
|
|
280
|
+
|
|
281
|
+
Informational banner highlighting app updates with clear benefits and actions.
|
|
282
|
+
|
|
283
|
+
##### jsx
|
|
284
|
+
|
|
285
|
+
```jsx
|
|
286
|
+
<s-banner heading="Point of Sale v2.4 available" tone="info" dismissible>
|
|
287
|
+
New version includes faster checkout processing and inventory sync
|
|
288
|
+
improvements.
|
|
289
|
+
<s-button
|
|
290
|
+
slot="secondary-actions"
|
|
291
|
+
variant="secondary"
|
|
292
|
+
href="/admin/apps/pos/changelog"
|
|
293
|
+
>
|
|
294
|
+
View changes
|
|
295
|
+
</s-button>
|
|
296
|
+
<s-button slot="secondary-actions" variant="secondary">
|
|
297
|
+
Install update
|
|
298
|
+
</s-button>
|
|
299
|
+
</s-banner>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
##### html
|
|
303
|
+
|
|
304
|
+
```html
|
|
305
|
+
<s-banner heading="Point of Sale v2.4 available" tone="info" dismissible>
|
|
306
|
+
New version includes faster checkout processing and inventory sync
|
|
307
|
+
improvements.
|
|
308
|
+
<s-button
|
|
309
|
+
slot="secondary-actions"
|
|
310
|
+
variant="secondary"
|
|
311
|
+
href="/admin/apps/pos/changelog"
|
|
312
|
+
>
|
|
313
|
+
View changes
|
|
314
|
+
</s-button>
|
|
315
|
+
<s-button slot="secondary-actions" variant="secondary">
|
|
316
|
+
Install update
|
|
317
|
+
</s-button>
|
|
318
|
+
</s-banner>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Useful for
|
|
322
|
+
|
|
323
|
+
* Showing important information or changes
|
|
324
|
+
* Prompting merchants to take a specific action
|
|
325
|
+
* Displaying warnings, errors, or critical information
|
|
326
|
+
* Communicating persistent conditions that need attention
|
|
327
|
+
|
|
328
|
+
## Outside of a section
|
|
329
|
+
|
|
330
|
+
Banners placed outside of a section will display in their own card and should be located at the top of the page. They're useful for conveying messages that apply to the entire page or areas not visible within the viewport, such as validation errors further down the page.
|
|
331
|
+
|
|
332
|
+
## In a section
|
|
333
|
+
|
|
334
|
+
Banners placed inside a section will have styles applied contextually. They're useful for conveying messages relevant to a specific section or piece of content.
|
|
335
|
+
|
|
336
|
+
## Best practices
|
|
337
|
+
|
|
338
|
+
* Seeing these banners can be stressful, so use them sparingly to avoid overwhelming users.
|
|
339
|
+
* Focus on a single piece of information or required action to avoid overwhelming users.
|
|
340
|
+
* Make the message concise and scannable. Users shouldn’t need to spend a lot of time figuring out what they need to know and do.
|
|
341
|
+
* Info, Warning and Critical banners should contain a call to action and clear next steps. Users should know what to do after seeing the banner.
|
|
342
|
+
* Avoid banners that can't be dismissed unless the user is required to take action.
|
|
343
|
+
|
|
344
|
+
## Content guidelines
|
|
345
|
+
|
|
346
|
+
* Keep titles concise and clear
|
|
347
|
+
* Limit body content to 1-2 sentences where possible
|
|
348
|
+
* Use action-led buttons with strong verbs (e.g., "Activate Apple Pay" not "Try Apple Pay")
|
|
349
|
+
* Avoid unnecessary words and articles in button text
|
|
350
|
+
* For warning and critical banners, explain how to resolve the issue
|