@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/chip.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Chip
|
|
3
|
+
description: >-
|
|
4
|
+
Represents a set of user-supplied keywords that help label, organize, and
|
|
5
|
+
categorize objects. Used to categorize or highlight content attributes. They
|
|
6
|
+
are often displayed near the content they classify, enhancing discoverability
|
|
7
|
+
by allowing users to identify items with similar properties.
|
|
8
|
+
api_name: app-home
|
|
9
|
+
source_url:
|
|
10
|
+
html: >-
|
|
11
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/titles-and-text/chip
|
|
12
|
+
md: >-
|
|
13
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/titles-and-text/chip.md
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Chip
|
|
17
|
+
|
|
18
|
+
Represents a set of user-supplied keywords that help label, organize, and categorize objects. Used to categorize or highlight content attributes. They are often displayed near the content they classify, enhancing discoverability by allowing users to identify items with similar properties.
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
* accessibilityLabel
|
|
23
|
+
|
|
24
|
+
string
|
|
25
|
+
|
|
26
|
+
A label that describes the purpose or contents of the Chip. It will be read to users using assistive technologies such as screen readers.
|
|
27
|
+
|
|
28
|
+
* color
|
|
29
|
+
|
|
30
|
+
ColorKeyword
|
|
31
|
+
|
|
32
|
+
Default: 'base'
|
|
33
|
+
|
|
34
|
+
Modify the color to be more or less intense.
|
|
35
|
+
|
|
36
|
+
### ColorKeyword
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
'subdued' | 'base' | 'strong'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Slots
|
|
43
|
+
|
|
44
|
+
* children
|
|
45
|
+
|
|
46
|
+
HTMLElement
|
|
47
|
+
|
|
48
|
+
The content of the Chip.
|
|
49
|
+
|
|
50
|
+
* graphic
|
|
51
|
+
|
|
52
|
+
HTMLElement
|
|
53
|
+
|
|
54
|
+
The graphic to display in the chip.
|
|
55
|
+
|
|
56
|
+
Only accepts `Icon` components.
|
|
57
|
+
|
|
58
|
+
Examples
|
|
59
|
+
|
|
60
|
+
### Examples
|
|
61
|
+
|
|
62
|
+
* #### Code
|
|
63
|
+
|
|
64
|
+
##### jsx
|
|
65
|
+
|
|
66
|
+
```jsx
|
|
67
|
+
<s-chip>Chip</s-chip>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
##### html
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<s-chip>Chip</s-chip>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
* #### Basic usage
|
|
77
|
+
|
|
78
|
+
##### Description
|
|
79
|
+
|
|
80
|
+
Simple chip displaying product status without an icon.
|
|
81
|
+
|
|
82
|
+
##### jsx
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
<s-chip color="base" accessibilityLabel="Product status indicator">
|
|
86
|
+
Active
|
|
87
|
+
</s-chip>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
##### html
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<s-chip color="base" accessibilityLabel="Product status indicator">
|
|
94
|
+
Active
|
|
95
|
+
</s-chip>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
* #### With icon graphic
|
|
99
|
+
|
|
100
|
+
##### Description
|
|
101
|
+
|
|
102
|
+
Chip enhanced with an icon to provide visual context for the category.
|
|
103
|
+
|
|
104
|
+
##### jsx
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
<s-chip color="strong" accessibilityLabel="Product category">
|
|
108
|
+
<s-icon slot="graphic" type="catalog-product" size="small" />
|
|
109
|
+
Electronics
|
|
110
|
+
</s-chip>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
##### html
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<s-chip color="strong" accessibilityLabel="Product category">
|
|
117
|
+
<s-icon slot="graphic" type="catalog-product" size="small"></s-icon>
|
|
118
|
+
Electronics
|
|
119
|
+
</s-chip>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
* #### Color variants
|
|
123
|
+
|
|
124
|
+
##### Description
|
|
125
|
+
|
|
126
|
+
Demonstrates all three color variants for different levels of visual emphasis.
|
|
127
|
+
|
|
128
|
+
##### jsx
|
|
129
|
+
|
|
130
|
+
```jsx
|
|
131
|
+
<s-stack direction="inline" gap="base">
|
|
132
|
+
<s-chip color="subdued" accessibilityLabel="Secondary information">
|
|
133
|
+
Draft
|
|
134
|
+
</s-chip>
|
|
135
|
+
<s-chip color="base" accessibilityLabel="Standard information">
|
|
136
|
+
Published
|
|
137
|
+
</s-chip>
|
|
138
|
+
<s-chip color="strong" accessibilityLabel="Important status">
|
|
139
|
+
<s-icon slot="graphic" type="check" size="small" />
|
|
140
|
+
Verified
|
|
141
|
+
</s-chip>
|
|
142
|
+
</s-stack>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
##### html
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<s-stack direction="inline" gap="base">
|
|
149
|
+
<s-chip color="subdued" accessibilityLabel="Secondary information">
|
|
150
|
+
Draft
|
|
151
|
+
</s-chip>
|
|
152
|
+
<s-chip color="base" accessibilityLabel="Standard information">
|
|
153
|
+
Published
|
|
154
|
+
</s-chip>
|
|
155
|
+
<s-chip color="strong" accessibilityLabel="Important status">
|
|
156
|
+
<s-icon slot="graphic" type="check" size="small"></s-icon>
|
|
157
|
+
Verified
|
|
158
|
+
</s-chip>
|
|
159
|
+
</s-stack>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
* #### Product status
|
|
163
|
+
|
|
164
|
+
##### Description
|
|
165
|
+
|
|
166
|
+
Common status indicators demonstrating chips in real-world product management scenarios.
|
|
167
|
+
|
|
168
|
+
##### jsx
|
|
169
|
+
|
|
170
|
+
```jsx
|
|
171
|
+
<s-stack direction="inline" gap="base">
|
|
172
|
+
<s-chip color="base" accessibilityLabel="Product status">
|
|
173
|
+
Active
|
|
174
|
+
</s-chip>
|
|
175
|
+
<s-chip color="subdued" accessibilityLabel="Product status">
|
|
176
|
+
Draft
|
|
177
|
+
</s-chip>
|
|
178
|
+
<s-chip color="strong" accessibilityLabel="Product status">
|
|
179
|
+
<s-icon slot="graphic" type="check" size="small" />
|
|
180
|
+
Published
|
|
181
|
+
</s-chip>
|
|
182
|
+
</s-stack>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
##### html
|
|
186
|
+
|
|
187
|
+
```html
|
|
188
|
+
<s-stack direction="inline" gap="base">
|
|
189
|
+
<s-chip color="base" accessibilityLabel="Product status">Active</s-chip>
|
|
190
|
+
<s-chip color="subdued" accessibilityLabel="Product status">Draft</s-chip>
|
|
191
|
+
<s-chip color="strong" accessibilityLabel="Product status">
|
|
192
|
+
<s-icon slot="graphic" type="check" size="small"></s-icon>
|
|
193
|
+
Published
|
|
194
|
+
</s-chip>
|
|
195
|
+
</s-stack>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
* #### Text truncation
|
|
199
|
+
|
|
200
|
+
##### Description
|
|
201
|
+
|
|
202
|
+
Demonstrates automatic text truncation for long content within a constrained width.
|
|
203
|
+
|
|
204
|
+
##### jsx
|
|
205
|
+
|
|
206
|
+
```jsx
|
|
207
|
+
<s-box maxInlineSize="200px">
|
|
208
|
+
<s-stack gap="base">
|
|
209
|
+
<s-chip color="base" accessibilityLabel="Long product name">
|
|
210
|
+
This is a very long product name that will be truncated with ellipsis when
|
|
211
|
+
it exceeds the container width
|
|
212
|
+
</s-chip>
|
|
213
|
+
<s-chip color="strong" accessibilityLabel="Long category name">
|
|
214
|
+
<s-icon slot="graphic" type="catalog-product" size="small" />
|
|
215
|
+
Electronics and computer accessories category with extended description
|
|
216
|
+
</s-chip>
|
|
217
|
+
</s-stack>
|
|
218
|
+
</s-box>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
##### html
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<s-box maxInlineSize="200px">
|
|
225
|
+
<s-stack gap="base">
|
|
226
|
+
<s-chip color="base" accessibilityLabel="Long product name">
|
|
227
|
+
This is a very long product name that will be truncated with ellipsis when
|
|
228
|
+
it exceeds the container width
|
|
229
|
+
</s-chip>
|
|
230
|
+
<s-chip color="strong" accessibilityLabel="Long category name">
|
|
231
|
+
<s-icon slot="graphic" type="catalog-product" size="small"></s-icon>
|
|
232
|
+
Electronics and computer accessories category with extended description
|
|
233
|
+
</s-chip>
|
|
234
|
+
</s-stack>
|
|
235
|
+
</s-box>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Useful for
|
|
239
|
+
|
|
240
|
+
* Labeling, organizing, and categorizing objects
|
|
241
|
+
* Highlighting content attributes
|
|
242
|
+
* Enhancing discoverability by identifying items with similar properties
|
|
243
|
+
|
|
244
|
+
## Best practices
|
|
245
|
+
|
|
246
|
+
* `subdued`: use for secondary or less important information
|
|
247
|
+
* `base`: use as default color
|
|
248
|
+
* `strong`: use for important or verified status
|
|
249
|
+
* Text truncates automatically, keep labels short to avoid truncation
|
|
250
|
+
* Chips are static indicators, not interactive or dismissible. For interactive chips, use ClickableChip
|
|
251
|
+
* Add icons to `graphic` slot to provide visual context
|
|
252
|
+
* Display chips near the content they classify
|
|
253
|
+
|
|
254
|
+
## Content guidelines
|
|
255
|
+
|
|
256
|
+
Chip labels should:
|
|
257
|
+
|
|
258
|
+
* Be short and concise to avoid truncation
|
|
259
|
+
* Use `accessibilityLabel` to describe purpose for screen readers
|
|
260
|
+
* Common status labels: `Active`, `Draft`, `Published`, `Verified`
|
|
261
|
+
* Common category labels: `Product type`, `Collection`, `Tag name`
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ChoiceList
|
|
3
|
+
description: >-
|
|
4
|
+
Present multiple options to users, allowing either single selections with
|
|
5
|
+
radio buttons or multiple selections with checkboxes.
|
|
6
|
+
api_name: app-home
|
|
7
|
+
source_url:
|
|
8
|
+
html: >-
|
|
9
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/forms/choicelist
|
|
10
|
+
md: >-
|
|
11
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/forms/choicelist.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# ChoiceList
|
|
15
|
+
|
|
16
|
+
Present multiple options to users, allowing either single selections with radio buttons or multiple selections with checkboxes.
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
* details
|
|
21
|
+
|
|
22
|
+
string
|
|
23
|
+
|
|
24
|
+
Additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user.
|
|
25
|
+
|
|
26
|
+
This will also be exposed to screen reader users.
|
|
27
|
+
|
|
28
|
+
* disabled
|
|
29
|
+
|
|
30
|
+
boolean
|
|
31
|
+
|
|
32
|
+
Default: false
|
|
33
|
+
|
|
34
|
+
Disables the field, disallowing any interaction.
|
|
35
|
+
|
|
36
|
+
`disabled` on any child choices is ignored when this is true.
|
|
37
|
+
|
|
38
|
+
* error
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
Indicate an error to the user. The field will be given a specific stylistic treatment to communicate problems that have to be resolved immediately.
|
|
43
|
+
|
|
44
|
+
* label
|
|
45
|
+
|
|
46
|
+
string
|
|
47
|
+
|
|
48
|
+
Content to use as the field label.
|
|
49
|
+
|
|
50
|
+
* labelAccessibilityVisibility
|
|
51
|
+
|
|
52
|
+
"visible" | "exclusive"
|
|
53
|
+
|
|
54
|
+
Default: 'visible'
|
|
55
|
+
|
|
56
|
+
Changes the visibility of the component's label.
|
|
57
|
+
|
|
58
|
+
* `visible`: the label is visible to all users.
|
|
59
|
+
* `exclusive`: the label is visually hidden but remains in the accessibility tree.
|
|
60
|
+
|
|
61
|
+
* multiple
|
|
62
|
+
|
|
63
|
+
boolean
|
|
64
|
+
|
|
65
|
+
Default: false
|
|
66
|
+
|
|
67
|
+
Whether multiple choices can be selected.
|
|
68
|
+
|
|
69
|
+
* name
|
|
70
|
+
|
|
71
|
+
string
|
|
72
|
+
|
|
73
|
+
An identifier for the field that is unique within the nearest containing form.
|
|
74
|
+
|
|
75
|
+
* values
|
|
76
|
+
|
|
77
|
+
string\[]
|
|
78
|
+
|
|
79
|
+
An array of the `value`s of the selected options.
|
|
80
|
+
|
|
81
|
+
This is a convenience prop for setting the `selected` prop on child options.
|
|
82
|
+
|
|
83
|
+
## Events
|
|
84
|
+
|
|
85
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
86
|
+
|
|
87
|
+
* change
|
|
88
|
+
|
|
89
|
+
CallbackEventListener\<typeof tagName> | null
|
|
90
|
+
|
|
91
|
+
* input
|
|
92
|
+
|
|
93
|
+
CallbackEventListener\<typeof tagName> | null
|
|
94
|
+
|
|
95
|
+
### CallbackEventListener
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
(EventListener & {
|
|
99
|
+
(event: CallbackEvent<T>): void;
|
|
100
|
+
}) | null
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### CallbackEvent
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
Event & {
|
|
107
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Choice
|
|
112
|
+
|
|
113
|
+
Create options that let users select one or multiple items from a list of choices.
|
|
114
|
+
|
|
115
|
+
* accessibilityLabel
|
|
116
|
+
|
|
117
|
+
string
|
|
118
|
+
|
|
119
|
+
A label used for users using assistive technologies like screen readers. When set, any children or `label` supplied will not be announced. This can also be used to display a control without a visual label, while still providing context to users using screen readers.
|
|
120
|
+
|
|
121
|
+
* defaultSelected
|
|
122
|
+
|
|
123
|
+
boolean
|
|
124
|
+
|
|
125
|
+
Default: false
|
|
126
|
+
|
|
127
|
+
Whether the control is active by default.
|
|
128
|
+
|
|
129
|
+
* disabled
|
|
130
|
+
|
|
131
|
+
boolean
|
|
132
|
+
|
|
133
|
+
Default: false
|
|
134
|
+
|
|
135
|
+
Disables the control, disallowing any interaction.
|
|
136
|
+
|
|
137
|
+
* selected
|
|
138
|
+
|
|
139
|
+
boolean
|
|
140
|
+
|
|
141
|
+
Default: false
|
|
142
|
+
|
|
143
|
+
Whether the control is active.
|
|
144
|
+
|
|
145
|
+
* value
|
|
146
|
+
|
|
147
|
+
string
|
|
148
|
+
|
|
149
|
+
The value used in form data when the control is checked.
|
|
150
|
+
|
|
151
|
+
## Slots
|
|
152
|
+
|
|
153
|
+
* children
|
|
154
|
+
|
|
155
|
+
HTMLElement
|
|
156
|
+
|
|
157
|
+
Content to use as the choice label.
|
|
158
|
+
|
|
159
|
+
The label is produced by extracting and concatenating the text nodes from the provided content; any markup or element structure is ignored.
|
|
160
|
+
|
|
161
|
+
* details
|
|
162
|
+
|
|
163
|
+
HTMLElement
|
|
164
|
+
|
|
165
|
+
Additional text to provide context or guidance for the input.
|
|
166
|
+
|
|
167
|
+
This text is displayed along with the input and its label to offer more information or instructions to the user.
|
|
168
|
+
|
|
169
|
+
Examples
|
|
170
|
+
|
|
171
|
+
### Examples
|
|
172
|
+
|
|
173
|
+
* #### Code
|
|
174
|
+
|
|
175
|
+
##### jsx
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
const handleChange = (event) => {
|
|
179
|
+
console.log('Values: ', event.currentTarget.values)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<s-choice-list
|
|
184
|
+
label="Company name"
|
|
185
|
+
name="Company name"
|
|
186
|
+
details="The company name will be displayed on the checkout page."
|
|
187
|
+
onChange={handleChange}
|
|
188
|
+
>
|
|
189
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
190
|
+
<s-choice value="optional">Optional</s-choice>
|
|
191
|
+
<s-choice value="required">Required</s-choice>
|
|
192
|
+
</s-choice-list>
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
##### html
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<script>
|
|
200
|
+
const handleChange = (event) =>
|
|
201
|
+
console.log('Values: ', event.currentTarget.values);
|
|
202
|
+
</script>
|
|
203
|
+
<s-choice-list
|
|
204
|
+
label="Company name"
|
|
205
|
+
name="Company name"
|
|
206
|
+
details="The company name will be displayed on the checkout page."
|
|
207
|
+
onChange="handleChange(event)"
|
|
208
|
+
>
|
|
209
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
210
|
+
<s-choice value="optional">Optional</s-choice>
|
|
211
|
+
<s-choice value="required">Required</s-choice>
|
|
212
|
+
</s-choice-list>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
* #### Basic usage
|
|
216
|
+
|
|
217
|
+
##### Description
|
|
218
|
+
|
|
219
|
+
Demonstrates a basic ChoiceList with single selection, showing how to create a group of radio button choices.
|
|
220
|
+
|
|
221
|
+
##### jsx
|
|
222
|
+
|
|
223
|
+
```jsx
|
|
224
|
+
<s-choice-list label="Product visibility" name="visibility">
|
|
225
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
226
|
+
<s-choice value="optional">Optional</s-choice>
|
|
227
|
+
<s-choice value="required" selected>
|
|
228
|
+
Required
|
|
229
|
+
</s-choice>
|
|
230
|
+
</s-choice-list>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
##### html
|
|
234
|
+
|
|
235
|
+
```html
|
|
236
|
+
<s-choice-list label="Product visibility" name="visibility">
|
|
237
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
238
|
+
<s-choice value="optional">Optional</s-choice>
|
|
239
|
+
<s-choice value="required" selected>Required</s-choice>
|
|
240
|
+
</s-choice-list>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
* #### Multiple selections
|
|
244
|
+
|
|
245
|
+
##### Description
|
|
246
|
+
|
|
247
|
+
Illustrates a ChoiceList with multiple selection enabled, allowing users to choose multiple options with additional descriptive details for each choice.
|
|
248
|
+
|
|
249
|
+
##### jsx
|
|
250
|
+
|
|
251
|
+
```jsx
|
|
252
|
+
<s-choice-list label="Checkout options" name="checkout" multiple>
|
|
253
|
+
<s-choice value="shipping" selected>
|
|
254
|
+
Use the shipping address as the billing address by default
|
|
255
|
+
<s-text slot="details">
|
|
256
|
+
Reduces the number of fields required to check out. The billing address
|
|
257
|
+
can still be edited.
|
|
258
|
+
</s-text>
|
|
259
|
+
</s-choice>
|
|
260
|
+
<s-choice value="confirmation">
|
|
261
|
+
Require a confirmation step
|
|
262
|
+
<s-text slot="details">
|
|
263
|
+
Customers must review their order details before purchasing.
|
|
264
|
+
</s-text>
|
|
265
|
+
</s-choice>
|
|
266
|
+
</s-choice-list>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
##### html
|
|
270
|
+
|
|
271
|
+
```html
|
|
272
|
+
<s-choice-list label="Checkout options" name="checkout" multiple>
|
|
273
|
+
<s-choice value="shipping" selected>
|
|
274
|
+
Use the shipping address as the billing address by default
|
|
275
|
+
<s-text slot="details">
|
|
276
|
+
Reduces the number of fields required to check out. The billing address
|
|
277
|
+
can still be edited.
|
|
278
|
+
</s-text>
|
|
279
|
+
</s-choice>
|
|
280
|
+
<s-choice value="confirmation">
|
|
281
|
+
Require a confirmation step
|
|
282
|
+
<s-text slot="details">
|
|
283
|
+
Customers must review their order details before purchasing.
|
|
284
|
+
</s-text>
|
|
285
|
+
</s-choice>
|
|
286
|
+
</s-choice-list>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
* #### With error state
|
|
290
|
+
|
|
291
|
+
##### Description
|
|
292
|
+
|
|
293
|
+
Shows how to display an error message in a ChoiceList when an invalid selection is made or a validation constraint is not met.
|
|
294
|
+
|
|
295
|
+
##### jsx
|
|
296
|
+
|
|
297
|
+
```jsx
|
|
298
|
+
<s-choice-list
|
|
299
|
+
label="Product visibility"
|
|
300
|
+
error="Please select an option"
|
|
301
|
+
>
|
|
302
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
303
|
+
<s-choice value="optional">Optional</s-choice>
|
|
304
|
+
<s-choice value="required">Required</s-choice>
|
|
305
|
+
</s-choice-list>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
##### html
|
|
309
|
+
|
|
310
|
+
```html
|
|
311
|
+
<s-choice-list
|
|
312
|
+
label="Product visibility"
|
|
313
|
+
name="visibility"
|
|
314
|
+
error="Product visibility cannot be hidden at this time"
|
|
315
|
+
>
|
|
316
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
317
|
+
<s-choice value="optional">Optional</s-choice>
|
|
318
|
+
<s-choice value="required" selected>Required</s-choice>
|
|
319
|
+
</s-choice-list>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
* #### Multiple choices with details
|
|
323
|
+
|
|
324
|
+
##### Description
|
|
325
|
+
|
|
326
|
+
Showcases a multiple-selection ChoiceList with each option including detailed information.
|
|
327
|
+
|
|
328
|
+
##### jsx
|
|
329
|
+
|
|
330
|
+
```jsx
|
|
331
|
+
<s-choice-list
|
|
332
|
+
label="Available shipping methods"
|
|
333
|
+
name="shipping-methods"
|
|
334
|
+
multiple
|
|
335
|
+
>
|
|
336
|
+
<s-choice value="standard" selected>
|
|
337
|
+
Standard shipping
|
|
338
|
+
<s-text slot="details">5-7 business days delivery</s-text>
|
|
339
|
+
</s-choice>
|
|
340
|
+
<s-choice value="express" selected>
|
|
341
|
+
Express shipping
|
|
342
|
+
<s-text slot="details">2-3 business days delivery</s-text>
|
|
343
|
+
</s-choice>
|
|
344
|
+
<s-choice value="overnight">
|
|
345
|
+
Overnight shipping
|
|
346
|
+
<s-text slot="details">Next business day delivery</s-text>
|
|
347
|
+
</s-choice>
|
|
348
|
+
</s-choice-list>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
##### html
|
|
352
|
+
|
|
353
|
+
```html
|
|
354
|
+
<s-choice-list
|
|
355
|
+
label="Available shipping methods"
|
|
356
|
+
name="shipping-methods"
|
|
357
|
+
multiple
|
|
358
|
+
>
|
|
359
|
+
<s-choice value="standard" selected>
|
|
360
|
+
Standard shipping
|
|
361
|
+
<s-text slot="details">5-7 business days delivery</s-text>
|
|
362
|
+
</s-choice>
|
|
363
|
+
<s-choice value="express" selected>
|
|
364
|
+
Express shipping
|
|
365
|
+
<s-text slot="details">2-3 business days delivery</s-text>
|
|
366
|
+
</s-choice>
|
|
367
|
+
<s-choice value="overnight">
|
|
368
|
+
Overnight shipping
|
|
369
|
+
<s-text slot="details">Next business day delivery</s-text>
|
|
370
|
+
</s-choice>
|
|
371
|
+
</s-choice-list>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
* #### Choice list validation
|
|
375
|
+
|
|
376
|
+
##### Description
|
|
377
|
+
|
|
378
|
+
Interactive example showing required choice validation with dynamic error messages.
|
|
379
|
+
|
|
380
|
+
##### jsx
|
|
381
|
+
|
|
382
|
+
```jsx
|
|
383
|
+
const [error, setError] = useState('Please select at least one option');
|
|
384
|
+
|
|
385
|
+
return (
|
|
386
|
+
<s-section>
|
|
387
|
+
<s-stack gap="base" justifyContent="start">
|
|
388
|
+
<s-choice-list
|
|
389
|
+
label="Product visibility"
|
|
390
|
+
name="visibility"
|
|
391
|
+
error={error}
|
|
392
|
+
onChange={(e) => {
|
|
393
|
+
setError(e.currentTarget.values.length > 0 ? '' : 'Please select at least one option');
|
|
394
|
+
}}
|
|
395
|
+
>
|
|
396
|
+
<s-choice value="hidden">Hidden</s-choice>
|
|
397
|
+
<s-choice value="optional">Optional</s-choice>
|
|
398
|
+
<s-choice value="required">Required</s-choice>
|
|
399
|
+
</s-choice-list>
|
|
400
|
+
</s-stack>
|
|
401
|
+
</s-section>
|
|
402
|
+
)
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## Best practices
|
|
406
|
+
|
|
407
|
+
* Include a title that tells merchants what to do or explains the available options
|
|
408
|
+
* Label options clearly based on what the option will do
|
|
409
|
+
* Avoid mutually exclusive options when allowing multiple selection
|
|
410
|
+
|
|
411
|
+
## Content guidelines
|
|
412
|
+
|
|
413
|
+
* Write titles and choices in sentence case
|
|
414
|
+
* End titles with a colon if they introduce the list
|
|
415
|
+
* Start each choice with a capital letter
|
|
416
|
+
* Don't use commas or semicolons at the end of lines
|