@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/button.md
ADDED
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Button
|
|
3
|
+
description: >-
|
|
4
|
+
Triggers actions or events, such as submitting forms, opening dialogs, or
|
|
5
|
+
navigating to other pages. Use Button to let users perform specific tasks or
|
|
6
|
+
initiate interactions throughout the interface. Buttons can also function as
|
|
7
|
+
links, guiding users to internal or external destinations.
|
|
8
|
+
api_name: app-home
|
|
9
|
+
source_url:
|
|
10
|
+
html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/actions/button'
|
|
11
|
+
md: >-
|
|
12
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/actions/button.md
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Button
|
|
16
|
+
|
|
17
|
+
Triggers actions or events, such as submitting forms, opening dialogs, or navigating to other pages. Use Button to let users perform specific tasks or initiate interactions throughout the interface. Buttons can also function as links, guiding users to internal or external destinations.
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
* accessibilityLabel
|
|
22
|
+
|
|
23
|
+
string
|
|
24
|
+
|
|
25
|
+
A label that describes the purpose or contents of the Button. It will be read to users using assistive technologies such as screen readers.
|
|
26
|
+
|
|
27
|
+
Use this when using only an icon or the Button text is not enough context for users using assistive technologies.
|
|
28
|
+
|
|
29
|
+
* command
|
|
30
|
+
|
|
31
|
+
'--auto' | '--show' | '--hide' | '--toggle'
|
|
32
|
+
|
|
33
|
+
Default: '--auto'
|
|
34
|
+
|
|
35
|
+
Sets the action the [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) should take when this clickable is activated.
|
|
36
|
+
|
|
37
|
+
See the documentation of particular components for the actions they support.
|
|
38
|
+
|
|
39
|
+
* `--auto`: a default action for the target component.
|
|
40
|
+
* `--show`: shows the target component.
|
|
41
|
+
* `--hide`: hides the target component.
|
|
42
|
+
* `--toggle`: toggles the target component.
|
|
43
|
+
|
|
44
|
+
* commandFor
|
|
45
|
+
|
|
46
|
+
string
|
|
47
|
+
|
|
48
|
+
Sets the element the [commandFor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) should act on when this clickable is activated.
|
|
49
|
+
|
|
50
|
+
* disabled
|
|
51
|
+
|
|
52
|
+
boolean
|
|
53
|
+
|
|
54
|
+
Default: false
|
|
55
|
+
|
|
56
|
+
Disables the Button meaning it cannot be clicked or receive focus.
|
|
57
|
+
|
|
58
|
+
* download
|
|
59
|
+
|
|
60
|
+
string
|
|
61
|
+
|
|
62
|
+
Causes the browser to treat the linked URL as a download with the string being the file name. Download only works for same-origin URLs or the `blob:` and `data:` schemes.
|
|
63
|
+
|
|
64
|
+
* href
|
|
65
|
+
|
|
66
|
+
string
|
|
67
|
+
|
|
68
|
+
The URL to link to.
|
|
69
|
+
|
|
70
|
+
* If set, it will navigate to the location specified by `href` after executing the `click` event.
|
|
71
|
+
* If a `commandFor` is set, the `command` will be executed instead of the navigation.
|
|
72
|
+
|
|
73
|
+
* icon
|
|
74
|
+
|
|
75
|
+
"" | "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"
|
|
76
|
+
|
|
77
|
+
The type of icon to be displayed in the Button.
|
|
78
|
+
|
|
79
|
+
* interestFor
|
|
80
|
+
|
|
81
|
+
string
|
|
82
|
+
|
|
83
|
+
Sets the element the [interestFor](https://open-ui.org/components/interest-invokers.explainer/#the-pitch-in-code) should act on when this clickable is activated.
|
|
84
|
+
|
|
85
|
+
* loading
|
|
86
|
+
|
|
87
|
+
boolean
|
|
88
|
+
|
|
89
|
+
Default: false
|
|
90
|
+
|
|
91
|
+
Replaces content with a loading indicator while a background action is being performed.
|
|
92
|
+
|
|
93
|
+
This also disables the Button.
|
|
94
|
+
|
|
95
|
+
* target
|
|
96
|
+
|
|
97
|
+
"auto" | AnyString | "\_blank" | "\_self" | "\_parent" | "\_top"
|
|
98
|
+
|
|
99
|
+
Default: 'auto'
|
|
100
|
+
|
|
101
|
+
Specifies where to display the linked URL.
|
|
102
|
+
|
|
103
|
+
* tone
|
|
104
|
+
|
|
105
|
+
"critical" | "auto" | "neutral"
|
|
106
|
+
|
|
107
|
+
Default: 'auto'
|
|
108
|
+
|
|
109
|
+
Sets the tone of the Button based on the intention of the information being conveyed.
|
|
110
|
+
|
|
111
|
+
* type
|
|
112
|
+
|
|
113
|
+
"button" | "reset" | "submit"
|
|
114
|
+
|
|
115
|
+
Default: 'button'
|
|
116
|
+
|
|
117
|
+
The behavior of the Button.
|
|
118
|
+
|
|
119
|
+
* `submit`: Used to indicate the component acts as a submit button, meaning it submits the closest form.
|
|
120
|
+
* `button`: Used to indicate the component acts as a button, meaning it has no default action.
|
|
121
|
+
* `reset`: Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values).
|
|
122
|
+
|
|
123
|
+
This property is ignored if the component supports `href` or `commandFor`/`command` and one of them is set.
|
|
124
|
+
|
|
125
|
+
* variant
|
|
126
|
+
|
|
127
|
+
"auto" | "primary" | "secondary" | "tertiary"
|
|
128
|
+
|
|
129
|
+
Default: 'auto' - the variant is automatically determined by the Button's context
|
|
130
|
+
|
|
131
|
+
Changes the visual appearance of the Button.
|
|
132
|
+
|
|
133
|
+
### AnyString
|
|
134
|
+
|
|
135
|
+
Prevents widening string literal types in a union to \`string\`.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
string & {}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Events
|
|
142
|
+
|
|
143
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
144
|
+
|
|
145
|
+
* blur
|
|
146
|
+
|
|
147
|
+
CallbackEventListener\<typeof tagName> | null
|
|
148
|
+
|
|
149
|
+
* click
|
|
150
|
+
|
|
151
|
+
CallbackEventListener\<typeof tagName> | null
|
|
152
|
+
|
|
153
|
+
* focus
|
|
154
|
+
|
|
155
|
+
CallbackEventListener\<typeof tagName> | null
|
|
156
|
+
|
|
157
|
+
### CallbackEventListener
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
(EventListener & {
|
|
161
|
+
(event: CallbackEvent<T>): void;
|
|
162
|
+
}) | null
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### CallbackEvent
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
Event & {
|
|
169
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Slots
|
|
174
|
+
|
|
175
|
+
* children
|
|
176
|
+
|
|
177
|
+
HTMLElement
|
|
178
|
+
|
|
179
|
+
The content of the Button.
|
|
180
|
+
|
|
181
|
+
Examples
|
|
182
|
+
|
|
183
|
+
### Examples
|
|
184
|
+
|
|
185
|
+
* #### Code
|
|
186
|
+
|
|
187
|
+
##### jsx
|
|
188
|
+
|
|
189
|
+
```jsx
|
|
190
|
+
<>
|
|
191
|
+
<s-button variant="primary">Add Product</s-button>
|
|
192
|
+
<s-button variant="secondary">Save Theme</s-button>
|
|
193
|
+
</>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
##### html
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<s-button variant="primary">Add Product</s-button>
|
|
200
|
+
<s-button variant="secondary">Save Theme</s-button>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
* #### Basic usage
|
|
204
|
+
|
|
205
|
+
##### Description
|
|
206
|
+
|
|
207
|
+
Demonstrates a simple button with default styling, automatically determining its visual variant and using a clear, action-oriented label.
|
|
208
|
+
|
|
209
|
+
##### jsx
|
|
210
|
+
|
|
211
|
+
```jsx
|
|
212
|
+
<s-button>Save</s-button>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
##### html
|
|
216
|
+
|
|
217
|
+
```html
|
|
218
|
+
<s-button>Save</s-button>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
* #### Variants
|
|
222
|
+
|
|
223
|
+
##### Description
|
|
224
|
+
|
|
225
|
+
Showcases different button variants with varying visual emphasis, helping merchants understand action priorities through distinct styling.
|
|
226
|
+
|
|
227
|
+
##### jsx
|
|
228
|
+
|
|
229
|
+
```jsx
|
|
230
|
+
<s-stack direction="inline" gap="base">
|
|
231
|
+
<s-button variant="primary">Primary</s-button>
|
|
232
|
+
<s-button variant="secondary">Secondary</s-button>
|
|
233
|
+
<s-button variant="tertiary">Tertiary</s-button>
|
|
234
|
+
<s-button variant="auto">Auto</s-button>
|
|
235
|
+
</s-stack>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
##### html
|
|
239
|
+
|
|
240
|
+
```html
|
|
241
|
+
<s-stack direction="inline" gap="base">
|
|
242
|
+
<s-button variant="primary">Primary</s-button>
|
|
243
|
+
<s-button variant="secondary">Secondary</s-button>
|
|
244
|
+
<s-button variant="tertiary">Tertiary</s-button>
|
|
245
|
+
<s-button variant="auto">Auto</s-button>
|
|
246
|
+
</s-stack>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
* #### Tones
|
|
250
|
+
|
|
251
|
+
##### Description
|
|
252
|
+
|
|
253
|
+
Illustrates button tones that signal the semantic importance and potential impact of different actions through color and styling.
|
|
254
|
+
|
|
255
|
+
##### jsx
|
|
256
|
+
|
|
257
|
+
```jsx
|
|
258
|
+
<s-stack direction="inline" gap="base">
|
|
259
|
+
<s-button tone="critical">Delete</s-button>
|
|
260
|
+
<s-button tone="neutral">Save draft</s-button>
|
|
261
|
+
<s-button>Continue</s-button>
|
|
262
|
+
</s-stack>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
##### html
|
|
266
|
+
|
|
267
|
+
```html
|
|
268
|
+
<s-stack direction="inline" gap="base">
|
|
269
|
+
<s-button tone="critical">Delete</s-button>
|
|
270
|
+
<s-button tone="neutral">Save draft</s-button>
|
|
271
|
+
<s-button>Continue</s-button>
|
|
272
|
+
</s-stack>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
* #### With icon
|
|
276
|
+
|
|
277
|
+
##### Description
|
|
278
|
+
|
|
279
|
+
Showcases a button that combines a descriptive text label with an intuitive icon, enhancing visual communication of the action.
|
|
280
|
+
|
|
281
|
+
##### jsx
|
|
282
|
+
|
|
283
|
+
```jsx
|
|
284
|
+
<s-button icon="plus">Add product</s-button>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
##### html
|
|
288
|
+
|
|
289
|
+
```html
|
|
290
|
+
<s-button icon="plus">Add product</s-button>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
* #### Icon-only button
|
|
294
|
+
|
|
295
|
+
##### Description
|
|
296
|
+
|
|
297
|
+
Demonstrates an icon-only button with an accessibility label, providing a compact interface that remains screen reader friendly.
|
|
298
|
+
|
|
299
|
+
##### jsx
|
|
300
|
+
|
|
301
|
+
```jsx
|
|
302
|
+
<s-button icon="plus" accessibilityLabel="Add product" />
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
##### html
|
|
306
|
+
|
|
307
|
+
```html
|
|
308
|
+
<s-button icon="plus" accessibilityLabel="Add product"></s-button>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
* #### Loading state
|
|
312
|
+
|
|
313
|
+
##### Description
|
|
314
|
+
|
|
315
|
+
Illustrates buttons in various loading states, providing visual feedback during asynchronous operations.
|
|
316
|
+
|
|
317
|
+
##### jsx
|
|
318
|
+
|
|
319
|
+
```jsx
|
|
320
|
+
<s-stack direction="inline" gap="base">
|
|
321
|
+
<s-button loading variant="primary">
|
|
322
|
+
Saving product...
|
|
323
|
+
</s-button>
|
|
324
|
+
<s-button loading variant="secondary">
|
|
325
|
+
Updating 247 variants...
|
|
326
|
+
</s-button>
|
|
327
|
+
<s-button loading tone="neutral">
|
|
328
|
+
Processing shipment...
|
|
329
|
+
</s-button>
|
|
330
|
+
</s-stack>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
##### html
|
|
334
|
+
|
|
335
|
+
```html
|
|
336
|
+
<!-- Product save operation -->
|
|
337
|
+
<s-button loading variant="primary">Saving product...</s-button>
|
|
338
|
+
|
|
339
|
+
<!-- Bulk inventory update -->
|
|
340
|
+
<s-button loading variant="secondary">Updating 247 variants...</s-button>
|
|
341
|
+
|
|
342
|
+
<!-- Order fulfillment -->
|
|
343
|
+
<s-button loading tone="neutral">Processing shipment...</s-button>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
* #### Form states
|
|
347
|
+
|
|
348
|
+
##### Description
|
|
349
|
+
|
|
350
|
+
Demonstrates buttons in different interaction states, showing how to represent disabled controls and submit actions within forms.
|
|
351
|
+
|
|
352
|
+
##### jsx
|
|
353
|
+
|
|
354
|
+
```jsx
|
|
355
|
+
<s-stack direction="inline" gap="base">
|
|
356
|
+
<s-button disabled>Save draft</s-button>
|
|
357
|
+
<s-button type="submit" variant="primary">
|
|
358
|
+
Save product
|
|
359
|
+
</s-button>
|
|
360
|
+
</s-stack>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
##### html
|
|
364
|
+
|
|
365
|
+
```html
|
|
366
|
+
<s-stack direction="inline" gap="base">
|
|
367
|
+
<s-button disabled>Save draft</s-button>
|
|
368
|
+
<s-button type="submit" variant="primary">Save product</s-button>
|
|
369
|
+
</s-stack>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
* #### Link buttons
|
|
373
|
+
|
|
374
|
+
##### Description
|
|
375
|
+
|
|
376
|
+
Showcases buttons that act as hyperlinks, supporting navigation to different pages, external resources, and file downloads.
|
|
377
|
+
|
|
378
|
+
##### jsx
|
|
379
|
+
|
|
380
|
+
```jsx
|
|
381
|
+
<s-stack direction="inline" gap="base">
|
|
382
|
+
<s-button href="javascript:void(0)">View products</s-button>
|
|
383
|
+
<s-button href="javascript:void(0)" target="_blank">
|
|
384
|
+
Help docs
|
|
385
|
+
</s-button>
|
|
386
|
+
<s-button href="javascript:void(0)" download="sales-report.csv">
|
|
387
|
+
Export data
|
|
388
|
+
</s-button>
|
|
389
|
+
</s-stack>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
##### html
|
|
393
|
+
|
|
394
|
+
```html
|
|
395
|
+
<s-stack direction="inline" gap="base">
|
|
396
|
+
<s-button href="javascript:void(0)">View products</s-button>
|
|
397
|
+
<s-button href="javascript:void(0)" target="_blank">Help docs</s-button>
|
|
398
|
+
<s-button href="javascript:void(0)" download="sales-report.csv">
|
|
399
|
+
Export data
|
|
400
|
+
</s-button>
|
|
401
|
+
</s-stack>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
* #### Form submission buttons
|
|
405
|
+
|
|
406
|
+
##### Description
|
|
407
|
+
|
|
408
|
+
Demonstrates a button group with carefully aligned actions, showing how to create a clear visual hierarchy for form submission and cancellation.
|
|
409
|
+
|
|
410
|
+
##### jsx
|
|
411
|
+
|
|
412
|
+
```jsx
|
|
413
|
+
<s-stack direction="inline" gap="base" justifyContent="end">
|
|
414
|
+
<s-button variant="secondary">Cancel</s-button>
|
|
415
|
+
<s-button variant="primary" type="submit">
|
|
416
|
+
Save product
|
|
417
|
+
</s-button>
|
|
418
|
+
</s-stack>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
##### html
|
|
422
|
+
|
|
423
|
+
```html
|
|
424
|
+
<s-stack direction="inline" gap="base" justifyContent="end">
|
|
425
|
+
<s-button variant="secondary">Cancel</s-button>
|
|
426
|
+
<s-button variant="primary" type="submit">Save product</s-button>
|
|
427
|
+
</s-stack>
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
* #### Delete confirmation
|
|
431
|
+
|
|
432
|
+
##### Description
|
|
433
|
+
|
|
434
|
+
Illustrates a button pair for destructive actions, using a critical tone to emphasize the potentially irreversible nature of the operation.
|
|
435
|
+
|
|
436
|
+
##### jsx
|
|
437
|
+
|
|
438
|
+
```jsx
|
|
439
|
+
<s-stack direction="inline" gap="base">
|
|
440
|
+
<s-button variant="secondary">Cancel</s-button>
|
|
441
|
+
<s-button variant="primary" tone="critical">
|
|
442
|
+
Delete variant
|
|
443
|
+
</s-button>
|
|
444
|
+
</s-stack>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
##### html
|
|
448
|
+
|
|
449
|
+
```html
|
|
450
|
+
<s-stack direction="inline" gap="base">
|
|
451
|
+
<s-button variant="secondary">Cancel</s-button>
|
|
452
|
+
<s-button variant="primary" tone="critical">Delete variant</s-button>
|
|
453
|
+
</s-stack>
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
* #### Navigation button with icon
|
|
457
|
+
|
|
458
|
+
##### Description
|
|
459
|
+
|
|
460
|
+
Showcases a navigation button with an icon, enabling quick access to different sections of the interface.
|
|
461
|
+
|
|
462
|
+
##### jsx
|
|
463
|
+
|
|
464
|
+
```jsx
|
|
465
|
+
<s-button href="javascript:void(0)" icon="order">
|
|
466
|
+
View orders
|
|
467
|
+
</s-button>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
##### html
|
|
471
|
+
|
|
472
|
+
```html
|
|
473
|
+
<!-- Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. -->
|
|
474
|
+
<s-button href="javascript:void(0)" icon="order">View orders</s-button>
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
* #### Button group for bulk operations
|
|
478
|
+
|
|
479
|
+
##### Description
|
|
480
|
+
|
|
481
|
+
Demonstrates a button group for executing operations on multiple selected items.
|
|
482
|
+
|
|
483
|
+
##### jsx
|
|
484
|
+
|
|
485
|
+
```jsx
|
|
486
|
+
<s-stack direction="inline" gap="base">
|
|
487
|
+
<s-button variant="secondary">Export selected</s-button>
|
|
488
|
+
<s-button variant="primary" tone="critical">
|
|
489
|
+
Delete selected
|
|
490
|
+
</s-button>
|
|
491
|
+
</s-stack>
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
##### html
|
|
495
|
+
|
|
496
|
+
```html
|
|
497
|
+
<s-stack direction="inline" gap="base">
|
|
498
|
+
<s-button variant="secondary">Export selected</s-button>
|
|
499
|
+
<s-button variant="primary" tone="critical">Delete selected</s-button>
|
|
500
|
+
</s-stack>
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
* #### Icon-only buttons with labels
|
|
504
|
+
|
|
505
|
+
##### Description
|
|
506
|
+
|
|
507
|
+
Showcases a set of compact, icon-only buttons with accessibility labels, perfect for creating dense interfaces.
|
|
508
|
+
|
|
509
|
+
##### jsx
|
|
510
|
+
|
|
511
|
+
```jsx
|
|
512
|
+
<s-stack direction="inline" gap="base">
|
|
513
|
+
<s-button
|
|
514
|
+
icon="duplicate"
|
|
515
|
+
variant="tertiary"
|
|
516
|
+
accessibilityLabel="Duplicate product"
|
|
517
|
+
/>
|
|
518
|
+
<s-button
|
|
519
|
+
icon="view"
|
|
520
|
+
variant="tertiary"
|
|
521
|
+
accessibilityLabel="Preview product"
|
|
522
|
+
/>
|
|
523
|
+
<s-button
|
|
524
|
+
icon="menu-horizontal"
|
|
525
|
+
variant="tertiary"
|
|
526
|
+
accessibilityLabel="More actions"
|
|
527
|
+
/>
|
|
528
|
+
</s-stack>
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
##### html
|
|
532
|
+
|
|
533
|
+
```html
|
|
534
|
+
<s-stack direction="inline" gap="base">
|
|
535
|
+
<s-button
|
|
536
|
+
icon="duplicate"
|
|
537
|
+
variant="tertiary"
|
|
538
|
+
accessibilityLabel="Duplicate product"
|
|
539
|
+
></s-button>
|
|
540
|
+
<s-button
|
|
541
|
+
icon="view"
|
|
542
|
+
variant="tertiary"
|
|
543
|
+
accessibilityLabel="Preview product"
|
|
544
|
+
></s-button>
|
|
545
|
+
<s-button
|
|
546
|
+
icon="menu-horizontal"
|
|
547
|
+
variant="tertiary"
|
|
548
|
+
accessibilityLabel="More actions"
|
|
549
|
+
></s-button>
|
|
550
|
+
</s-stack>
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
* #### Component interactions
|
|
554
|
+
|
|
555
|
+
##### Description
|
|
556
|
+
|
|
557
|
+
Demonstrates advanced button capabilities using \`command\`, \`commandFor\`, and \`interestFor\` properties to enable dynamic component communication.
|
|
558
|
+
|
|
559
|
+
##### jsx
|
|
560
|
+
|
|
561
|
+
```jsx
|
|
562
|
+
<s-stack direction="inline" gap="base">
|
|
563
|
+
{/* Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. */}
|
|
564
|
+
<s-button href="javascript:void(0)">Edit details</s-button>
|
|
565
|
+
|
|
566
|
+
{/* Button that expresses interest in specific data */}
|
|
567
|
+
<s-button interestFor="selected-products">Bulk edit</s-button>
|
|
568
|
+
</s-stack>
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
##### html
|
|
572
|
+
|
|
573
|
+
```html
|
|
574
|
+
<s-stack direction="inline" gap="base">
|
|
575
|
+
<!-- Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. -->
|
|
576
|
+
<s-button href="javascript:void(0)">Edit details</s-button>
|
|
577
|
+
|
|
578
|
+
<!-- Button that expresses interest in specific data -->
|
|
579
|
+
<s-button interestFor="selected-products">Bulk edit</s-button>
|
|
580
|
+
</s-stack>
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## Useful for
|
|
584
|
+
|
|
585
|
+
* Taking primary actions like saving or creating resources
|
|
586
|
+
* Taking secondary actions like canceling forms or filtering results
|
|
587
|
+
* Triggering destructive operations like deletion or disconnection
|
|
588
|
+
* Accessing supplementary actions via tertiary buttons
|
|
589
|
+
|
|
590
|
+
## Best practices
|
|
591
|
+
|
|
592
|
+
* Be clearly and accurately labeled with strong, actionable verbs
|
|
593
|
+
* Use established button tones appropriately (e.g., critical tone only for actions that are difficult to undo)
|
|
594
|
+
* Prioritize the most important actions to avoid confusion
|
|
595
|
+
* Be positioned in consistent locations in the interface
|
|
596
|
+
* Use buttons for actions and links for navigation
|
|
597
|
+
|
|
598
|
+
## Content guidelines
|
|
599
|
+
|
|
600
|
+
* Use simple, concise verbs (e.g., "Save", "Edit", "Add tags")
|
|
601
|
+
* Write in sentence case
|
|
602
|
+
* Avoid unnecessary words and articles (e.g., "a", "an", "the")
|
|
603
|
+
* Don't use punctuation
|
|
604
|
+
* For icon-only buttons, use `accessibilityLabel` to describe the action
|