@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
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SearchField
|
|
3
|
+
description: >-
|
|
4
|
+
Let users enter search terms or find specific items using a single-line input
|
|
5
|
+
field.
|
|
6
|
+
api_name: app-home
|
|
7
|
+
source_url:
|
|
8
|
+
html: >-
|
|
9
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/forms/searchfield
|
|
10
|
+
md: >-
|
|
11
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/forms/searchfield.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Search​Field
|
|
15
|
+
|
|
16
|
+
Let users enter search terms or find specific items using a single-line input field.
|
|
17
|
+
|
|
18
|
+
## SearchField
|
|
19
|
+
|
|
20
|
+
A search input field that allows users to enter a search term.
|
|
21
|
+
|
|
22
|
+
* autocomplete
|
|
23
|
+
|
|
24
|
+
"on" | "off" | TextAutocompleteField | \`section-${string} one-time-code\` | "shipping one-time-code" | "billing one-time-code" | \`section-${string} shipping one-time-code\` | \`section-${string} billing one-time-code\` | \`section-${string} language\` | \`section-${string} organization\` | \`section-${string} additional-name\` | \`section-${string} address-level1\` | \`section-${string} address-level2\` | \`section-${string} address-level3\` | \`section-${string} address-level4\` | \`section-${string} address-line1\` | \`section-${string} address-line2\` | \`section-${string} address-line3\` | \`section-${string} country-name\` | \`section-${string} country\` | \`section-${string} family-name\` | \`section-${string} given-name\` | \`section-${string} honorific-prefix\` | \`section-${string} honorific-suffix\` | \`section-${string} name\` | \`section-${string} nickname\` | \`section-${string} organization-title\` | \`section-${string} postal-code\` | \`section-${string} sex\` | \`section-${string} street-address\` | \`section-${string} transaction-currency\` | \`section-${string} username\` | \`section-${string} cc-additional-name\` | \`section-${string} cc-family-name\` | \`section-${string} cc-given-name\` | \`section-${string} cc-name\` | \`section-${string} cc-type\` | "shipping language" | "shipping organization" | "shipping additional-name" | "shipping address-level1" | "shipping address-level2" | "shipping address-level3" | "shipping address-level4" | "shipping address-line1" | "shipping address-line2" | "shipping address-line3" | "shipping country-name" | "shipping country" | "shipping family-name" | "shipping given-name" | "shipping honorific-prefix" | "shipping honorific-suffix" | "shipping name" | "shipping nickname" | "shipping organization-title" | "shipping postal-code" | "shipping sex" | "shipping street-address" | "shipping transaction-currency" | "shipping username" | "shipping cc-additional-name" | "shipping cc-family-name" | "shipping cc-given-name" | "shipping cc-name" | "shipping cc-type" | "billing language" | "billing organization" | "billing additional-name" | "billing address-level1" | "billing address-level2" | "billing address-level3" | "billing address-level4" | "billing address-line1" | "billing address-line2" | "billing address-line3" | "billing country-name" | "billing country" | "billing family-name" | "billing given-name" | "billing honorific-prefix" | "billing honorific-suffix" | "billing name" | "billing nickname" | "billing organization-title" | "billing postal-code" | "billing sex" | "billing street-address" | "billing transaction-currency" | "billing username" | "billing cc-additional-name" | "billing cc-family-name" | "billing cc-given-name" | "billing cc-name" | "billing cc-type" | \`section-${string} shipping language\` | \`section-${string} shipping organization\` | \`section-${string} shipping additional-name\` | \`section-${string} shipping address-level1\` | \`section-${string} shipping address-level2\` | \`section-${string} shipping address-level3\` | \`section-${string} shipping address-level4\` | \`section-${string} shipping address-line1\` | \`section-${string} shipping address-line2\` | \`section-${string} shipping address-line3\` | \`section-${string} shipping country-name\` | \`section-${string} shipping country\` | \`section-${string} shipping family-name\` | \`section-${string} shipping given-name\` | \`section-${string} shipping honorific-prefix\` | \`section-${string} shipping honorific-suffix\` | \`section-${string} shipping name\` | \`section-${string} shipping nickname\` | \`section-${string} shipping organization-title\` | \`section-${string} shipping postal-code\` | \`section-${string} shipping sex\` | \`section-${string} shipping street-address\` | \`section-${string} shipping transaction-currency\` | \`section-${string} shipping username\` | \`section-${string} shipping cc-additional-name\` | \`section-${string} shipping cc-family-name\` | \`section-${string} shipping cc-given-name\` | \`section-${string} shipping cc-name\` | \`section-${string} shipping cc-type\` | \`section-${string} billing language\` | \`section-${string} billing organization\` | \`section-${string} billing additional-name\` | \`section-${string} billing address-level1\` | \`section-${string} billing address-level2\` | \`section-${string} billing address-level3\` | \`section-${string} billing address-level4\` | \`section-${string} billing address-line1\` | \`section-${string} billing address-line2\` | \`section-${string} billing address-line3\` | \`section-${string} billing country-name\` | \`section-${string} billing country\` | \`section-${string} billing family-name\` | \`section-${string} billing given-name\` | \`section-${string} billing honorific-prefix\` | \`section-${string} billing honorific-suffix\` | \`section-${string} billing name\` | \`section-${string} billing nickname\` | \`section-${string} billing organization-title\` | \`section-${string} billing postal-code\` | \`section-${string} billing sex\` | \`section-${string} billing street-address\` | \`section-${string} billing transaction-currency\` | \`section-${string} billing username\` | \`section-${string} billing cc-additional-name\` | \`section-${string} billing cc-family-name\` | \`section-${string} billing cc-given-name\` | \`section-${string} billing cc-name\` | \`section-${string} billing cc-type\`
|
|
25
|
+
|
|
26
|
+
Default: 'on' for everything else
|
|
27
|
+
|
|
28
|
+
A hint as to the intended content of the field.
|
|
29
|
+
|
|
30
|
+
When set to `on` (the default), this property indicates that the field should support autofill, but you do not have any more semantic information on the intended contents.
|
|
31
|
+
|
|
32
|
+
When set to `off`, you are indicating that this field contains sensitive information, or contents that are never saved, like one-time codes.
|
|
33
|
+
|
|
34
|
+
Alternatively, you can provide value which describes the specific data you would like to be entered into this field during autofill.
|
|
35
|
+
|
|
36
|
+
* defaultValue
|
|
37
|
+
|
|
38
|
+
string
|
|
39
|
+
|
|
40
|
+
The default value for the field.
|
|
41
|
+
|
|
42
|
+
* details
|
|
43
|
+
|
|
44
|
+
string
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
This will also be exposed to screen reader users.
|
|
49
|
+
|
|
50
|
+
* disabled
|
|
51
|
+
|
|
52
|
+
boolean
|
|
53
|
+
|
|
54
|
+
Default: false
|
|
55
|
+
|
|
56
|
+
Disables the field, disallowing any interaction.
|
|
57
|
+
|
|
58
|
+
* error
|
|
59
|
+
|
|
60
|
+
string
|
|
61
|
+
|
|
62
|
+
Indicate an error to the user. The field will be given a specific stylistic treatment to communicate problems that have to be resolved immediately.
|
|
63
|
+
|
|
64
|
+
* id
|
|
65
|
+
|
|
66
|
+
string
|
|
67
|
+
|
|
68
|
+
A unique identifier for the element.
|
|
69
|
+
|
|
70
|
+
* label
|
|
71
|
+
|
|
72
|
+
string
|
|
73
|
+
|
|
74
|
+
Content to use as the field label.
|
|
75
|
+
|
|
76
|
+
* labelAccessibilityVisibility
|
|
77
|
+
|
|
78
|
+
"visible" | "exclusive"
|
|
79
|
+
|
|
80
|
+
Default: 'visible'
|
|
81
|
+
|
|
82
|
+
Changes the visibility of the component's label.
|
|
83
|
+
|
|
84
|
+
* `visible`: the label is visible to all users.
|
|
85
|
+
* `exclusive`: the label is visually hidden but remains in the accessibility tree.
|
|
86
|
+
|
|
87
|
+
* maxLength
|
|
88
|
+
|
|
89
|
+
number
|
|
90
|
+
|
|
91
|
+
Default: Infinity
|
|
92
|
+
|
|
93
|
+
Specifies the maximum number of characters allowed.
|
|
94
|
+
|
|
95
|
+
* minLength
|
|
96
|
+
|
|
97
|
+
number
|
|
98
|
+
|
|
99
|
+
Default: 0
|
|
100
|
+
|
|
101
|
+
Specifies the min number of characters allowed.
|
|
102
|
+
|
|
103
|
+
* name
|
|
104
|
+
|
|
105
|
+
string
|
|
106
|
+
|
|
107
|
+
An identifier for the field that is unique within the nearest containing form.
|
|
108
|
+
|
|
109
|
+
* placeholder
|
|
110
|
+
|
|
111
|
+
string
|
|
112
|
+
|
|
113
|
+
A short hint that describes the expected value of the field.
|
|
114
|
+
|
|
115
|
+
* readOnly
|
|
116
|
+
|
|
117
|
+
boolean
|
|
118
|
+
|
|
119
|
+
Default: false
|
|
120
|
+
|
|
121
|
+
The field cannot be edited by the user. It is focusable will be announced by screen readers.
|
|
122
|
+
|
|
123
|
+
* required
|
|
124
|
+
|
|
125
|
+
boolean
|
|
126
|
+
|
|
127
|
+
Default: false
|
|
128
|
+
|
|
129
|
+
Whether the field needs a value. This requirement adds semantic value to the field, but it will not cause an error to appear automatically. If you want to present an error when this field is empty, you can do so with the `error` property.
|
|
130
|
+
|
|
131
|
+
* value
|
|
132
|
+
|
|
133
|
+
string
|
|
134
|
+
|
|
135
|
+
The current value for the field. If omitted, the field will be empty.
|
|
136
|
+
|
|
137
|
+
### TextAutocompleteField
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
'language' | 'organization' | 'additional-name' | 'address-level1' | 'address-level2' | 'address-level3' | 'address-level4' | 'address-line1' | 'address-line2' | 'address-line3' | 'country-name' | 'country' | 'family-name' | 'given-name' | 'honorific-prefix' | 'honorific-suffix' | 'name' | 'nickname' | 'one-time-code' | 'organization-title' | 'postal-code' | 'sex' | 'street-address' | 'transaction-currency' | 'username' | 'cc-additional-name' | 'cc-family-name' | 'cc-given-name' | 'cc-name' | 'cc-type'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Events
|
|
144
|
+
|
|
145
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
146
|
+
|
|
147
|
+
* blur
|
|
148
|
+
|
|
149
|
+
CallbackEventListener<'input'>
|
|
150
|
+
|
|
151
|
+
* change
|
|
152
|
+
|
|
153
|
+
CallbackEventListener<'input'>
|
|
154
|
+
|
|
155
|
+
* focus
|
|
156
|
+
|
|
157
|
+
CallbackEventListener<'input'>
|
|
158
|
+
|
|
159
|
+
* input
|
|
160
|
+
|
|
161
|
+
CallbackEventListener<'input'>
|
|
162
|
+
|
|
163
|
+
### CallbackEventListener
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
(EventListener & {
|
|
167
|
+
(event: CallbackEvent<T>): void;
|
|
168
|
+
}) | null
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### CallbackEvent
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
Event & {
|
|
175
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Examples
|
|
180
|
+
|
|
181
|
+
### Examples
|
|
182
|
+
|
|
183
|
+
* #### Code
|
|
184
|
+
|
|
185
|
+
##### jsx
|
|
186
|
+
|
|
187
|
+
```jsx
|
|
188
|
+
<s-search-field
|
|
189
|
+
label="Search"
|
|
190
|
+
labelAccessibilityVisibility="exclusive"
|
|
191
|
+
placeholder="Search items"
|
|
192
|
+
/>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
##### html
|
|
196
|
+
|
|
197
|
+
```html
|
|
198
|
+
<s-search-field
|
|
199
|
+
label="Search"
|
|
200
|
+
labelAccessibilityVisibility="exclusive"
|
|
201
|
+
placeholder="Search items"
|
|
202
|
+
></s-search-field>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
* #### Basic usage
|
|
206
|
+
|
|
207
|
+
##### Description
|
|
208
|
+
|
|
209
|
+
Demonstrates a standard search input field for product discovery, with a clear label, name, and placeholder text to guide user interaction.
|
|
210
|
+
|
|
211
|
+
##### jsx
|
|
212
|
+
|
|
213
|
+
```jsx
|
|
214
|
+
<s-search-field
|
|
215
|
+
label="Search products"
|
|
216
|
+
name="search"
|
|
217
|
+
placeholder="Search products..."
|
|
218
|
+
/>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
##### html
|
|
222
|
+
|
|
223
|
+
```html
|
|
224
|
+
<s-search-field
|
|
225
|
+
label="Search products"
|
|
226
|
+
name="search"
|
|
227
|
+
placeholder="Search products..."
|
|
228
|
+
></s-search-field>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
* #### With error state
|
|
232
|
+
|
|
233
|
+
##### Description
|
|
234
|
+
|
|
235
|
+
Illustrates how the search field handles and displays an error state when no results are found or when there's a search-related issue.
|
|
236
|
+
|
|
237
|
+
##### jsx
|
|
238
|
+
|
|
239
|
+
```jsx
|
|
240
|
+
<s-search-field
|
|
241
|
+
label="Search orders"
|
|
242
|
+
name="orderSearch"
|
|
243
|
+
error="No results found"
|
|
244
|
+
value="xyz123"
|
|
245
|
+
/>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
##### html
|
|
249
|
+
|
|
250
|
+
```html
|
|
251
|
+
<s-search-field
|
|
252
|
+
label="Search orders"
|
|
253
|
+
name="orderSearch"
|
|
254
|
+
error="No results found"
|
|
255
|
+
value="xyz123"
|
|
256
|
+
></s-search-field>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
* #### Disabled state
|
|
260
|
+
|
|
261
|
+
##### Description
|
|
262
|
+
|
|
263
|
+
Demonstrates the appearance and behavior of a search field when it is disabled, preventing user interaction.
|
|
264
|
+
|
|
265
|
+
##### jsx
|
|
266
|
+
|
|
267
|
+
```jsx
|
|
268
|
+
<s-search-field
|
|
269
|
+
label="Search customers"
|
|
270
|
+
name="customerSearch"
|
|
271
|
+
disabled
|
|
272
|
+
placeholder="Search is currently unavailable"
|
|
273
|
+
/>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
##### html
|
|
277
|
+
|
|
278
|
+
```html
|
|
279
|
+
<s-search-field
|
|
280
|
+
label="Search customers"
|
|
281
|
+
name="customerSearch"
|
|
282
|
+
disabled
|
|
283
|
+
placeholder="Search is currently unavailable"
|
|
284
|
+
></s-search-field>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
* #### With character limits
|
|
288
|
+
|
|
289
|
+
##### Description
|
|
290
|
+
|
|
291
|
+
Showcases a search field with minimum and maximum character length constraints, providing guidance on input requirements.
|
|
292
|
+
|
|
293
|
+
##### jsx
|
|
294
|
+
|
|
295
|
+
```jsx
|
|
296
|
+
<s-search-field
|
|
297
|
+
label="Search collections"
|
|
298
|
+
name="collectionSearch"
|
|
299
|
+
minLength={3}
|
|
300
|
+
maxLength={50}
|
|
301
|
+
placeholder="Enter at least 3 characters"
|
|
302
|
+
/>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
##### html
|
|
306
|
+
|
|
307
|
+
```html
|
|
308
|
+
<s-search-field
|
|
309
|
+
label="Search collections"
|
|
310
|
+
name="collectionSearch"
|
|
311
|
+
minLength="3"
|
|
312
|
+
maxLength="50"
|
|
313
|
+
placeholder="Enter at least 3 characters"
|
|
314
|
+
></s-search-field>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Best practices
|
|
318
|
+
|
|
319
|
+
* The SearchField automatically includes a clear button when text is entered, so you should not create your own clear button
|
package/docs/section.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Section
|
|
3
|
+
description: >-
|
|
4
|
+
Groups related content into clearly-defined thematic areas. Sections have
|
|
5
|
+
contextual styling that automatically adapts based on nesting depth. They also
|
|
6
|
+
adjust heading levels to maintain a meaningful and accessible page structure.
|
|
7
|
+
api_name: app-home
|
|
8
|
+
source_url:
|
|
9
|
+
html: >-
|
|
10
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/structure/section
|
|
11
|
+
md: >-
|
|
12
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/structure/section.md
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Section
|
|
16
|
+
|
|
17
|
+
Groups related content into clearly-defined thematic areas. Sections have contextual styling that automatically adapts based on nesting depth. They also adjust heading levels to maintain a meaningful and accessible page structure.
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
* accessibilityLabel
|
|
22
|
+
|
|
23
|
+
string
|
|
24
|
+
|
|
25
|
+
A label used to describe the section that will be announced by assistive technologies.
|
|
26
|
+
|
|
27
|
+
When no `heading` property is provided or included as a children of the Section, you **must** provide an `accessibilityLabel` to describe the Section. This is important as it allows assistive technologies to provide the right context to users.
|
|
28
|
+
|
|
29
|
+
* heading
|
|
30
|
+
|
|
31
|
+
string
|
|
32
|
+
|
|
33
|
+
A title that describes the content of the section.
|
|
34
|
+
|
|
35
|
+
* padding
|
|
36
|
+
|
|
37
|
+
"base" | "none"
|
|
38
|
+
|
|
39
|
+
Default: 'base'
|
|
40
|
+
|
|
41
|
+
Adjust the padding of all edges.
|
|
42
|
+
|
|
43
|
+
* `base`: applies padding that is appropriate for the element. Note that it may result in no padding if this is the right design decision in a particular context.
|
|
44
|
+
* `none`: removes all padding from the element. This can be useful when elements inside the Section need to span to the edge of the Section. For example, a full-width image. In this case, rely on `s-box` with a padding of 'base' to bring back the desired padding for the rest of the content.
|
|
45
|
+
|
|
46
|
+
## Slots
|
|
47
|
+
|
|
48
|
+
* children
|
|
49
|
+
|
|
50
|
+
HTMLElement
|
|
51
|
+
|
|
52
|
+
The content of the Section.
|
|
53
|
+
|
|
54
|
+
Examples
|
|
55
|
+
|
|
56
|
+
### Examples
|
|
57
|
+
|
|
58
|
+
* #### Code
|
|
59
|
+
|
|
60
|
+
##### jsx
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
<s-section heading="Online store dashboard">
|
|
64
|
+
<s-paragraph>View a summary of your online store’s performance.</s-paragraph>
|
|
65
|
+
</s-section>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
##### html
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<s-section heading="Online store dashboard">
|
|
72
|
+
<s-paragraph>View a summary of your online store’s performance.</s-paragraph>
|
|
73
|
+
</s-section>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
* #### Top-Level Section with Form Elements
|
|
77
|
+
|
|
78
|
+
##### Description
|
|
79
|
+
|
|
80
|
+
Demonstrates a level 1 section with a heading and multiple form fields. This example shows how sections provide visual hierarchy and structure for input elements.
|
|
81
|
+
|
|
82
|
+
##### jsx
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
<s-section heading="Customer information">
|
|
86
|
+
<s-text-field label="First name" value="John" />
|
|
87
|
+
<s-text-field label="Last name" value="Doe" />
|
|
88
|
+
<s-email-field label="Email" value="john@example.com" />
|
|
89
|
+
</s-section>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
##### html
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<!-- Level 1 section - elevated with shadow on desktop -->
|
|
96
|
+
<s-section heading="Customer information">
|
|
97
|
+
<s-text-field label="First name" value="John"></s-text-field>
|
|
98
|
+
<s-text-field label="Last name" value="Doe"></s-text-field>
|
|
99
|
+
<s-email-field label="Email" value="john@example.com"></s-email-field>
|
|
100
|
+
</s-section>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
* #### Nested Sections with Visual Level Differences
|
|
104
|
+
|
|
105
|
+
##### Description
|
|
106
|
+
|
|
107
|
+
Illustrates how sections can be nested to create a hierarchical layout, with each nested section automatically adjusting its visual style. This example demonstrates the automatic visual leveling of nested sections.
|
|
108
|
+
|
|
109
|
+
##### jsx
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
<s-stack gap="base">
|
|
113
|
+
{/* Level 1 section */}
|
|
114
|
+
<s-section heading="Order details">
|
|
115
|
+
<s-paragraph>Order #1234 placed on January 15, 2024</s-paragraph>
|
|
116
|
+
|
|
117
|
+
{/* Level 2 section - nested with different visual treatment */}
|
|
118
|
+
<s-section heading="Customer">
|
|
119
|
+
<s-text-field label="Name" value="Jane Smith" />
|
|
120
|
+
<s-text-field label="Email" value="jane@example.com" />
|
|
121
|
+
|
|
122
|
+
{/* Level 3 section - further nested */}
|
|
123
|
+
<s-section heading="Billing address">
|
|
124
|
+
<s-text-field label="Street" value="123 Main St" />
|
|
125
|
+
<s-text-field label="City" value="Toronto" />
|
|
126
|
+
</s-section>
|
|
127
|
+
</s-section>
|
|
128
|
+
|
|
129
|
+
{/* Another Level 2 section */}
|
|
130
|
+
<s-section heading="Items">
|
|
131
|
+
<s-paragraph>2 items totaling $49.99</s-paragraph>
|
|
132
|
+
</s-section>
|
|
133
|
+
</s-section>
|
|
134
|
+
</s-stack>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
##### html
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<s-stack gap="base">
|
|
141
|
+
<!-- Level 1 section -->
|
|
142
|
+
<s-section heading="Order details">
|
|
143
|
+
<s-paragraph>Order #1234 placed on January 15, 2024</s-paragraph>
|
|
144
|
+
|
|
145
|
+
<!-- Level 2 section - nested with different visual treatment -->
|
|
146
|
+
<s-section heading="Customer">
|
|
147
|
+
<s-text-field label="Name" value="Jane Smith"></s-text-field>
|
|
148
|
+
<s-text-field label="Email" value="jane@example.com"></s-text-field>
|
|
149
|
+
|
|
150
|
+
<!-- Level 3 section - further nested -->
|
|
151
|
+
<s-section heading="Billing address">
|
|
152
|
+
<s-text-field label="Street" value="123 Main St"></s-text-field>
|
|
153
|
+
<s-text-field label="City" value="Toronto"></s-text-field>
|
|
154
|
+
</s-section>
|
|
155
|
+
</s-section>
|
|
156
|
+
|
|
157
|
+
<!-- Another Level 2 section -->
|
|
158
|
+
<s-section heading="Items">
|
|
159
|
+
<s-paragraph>2 items totaling $49.99</s-paragraph>
|
|
160
|
+
</s-section>
|
|
161
|
+
</s-section>
|
|
162
|
+
</s-stack>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
* #### Section with Accessibility Label
|
|
166
|
+
|
|
167
|
+
##### Description
|
|
168
|
+
|
|
169
|
+
Shows how to add an accessibility label to a section, providing an additional hidden heading for screen readers while maintaining a visible heading.
|
|
170
|
+
|
|
171
|
+
##### jsx
|
|
172
|
+
|
|
173
|
+
```jsx
|
|
174
|
+
<s-section
|
|
175
|
+
heading="Payment summary"
|
|
176
|
+
accessibilityLabel="Order payment breakdown and totals"
|
|
177
|
+
>
|
|
178
|
+
<s-stack>
|
|
179
|
+
<s-paragraph>Subtotal: $42.99</s-paragraph>
|
|
180
|
+
<s-paragraph>Tax: $5.59</s-paragraph>
|
|
181
|
+
<s-paragraph>Shipping: $1.41</s-paragraph>
|
|
182
|
+
<s-paragraph>
|
|
183
|
+
<s-text type="strong">Total: $49.99</s-text>
|
|
184
|
+
</s-paragraph>
|
|
185
|
+
</s-stack>
|
|
186
|
+
</s-section>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
##### html
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<s-section
|
|
193
|
+
heading="Payment summary"
|
|
194
|
+
accessibilityLabel="Order payment breakdown and totals"
|
|
195
|
+
>
|
|
196
|
+
<s-stack gap="base">
|
|
197
|
+
<s-paragraph>Subtotal: $42.99</s-paragraph>
|
|
198
|
+
<s-paragraph>Tax: $5.59</s-paragraph>
|
|
199
|
+
<s-paragraph>Shipping: $1.41</s-paragraph>
|
|
200
|
+
<s-paragraph>
|
|
201
|
+
<s-text type="strong">Total: $49.99</s-text>
|
|
202
|
+
</s-paragraph>
|
|
203
|
+
</s-stack>
|
|
204
|
+
</s-section>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
* #### Full-width Content Layout
|
|
208
|
+
|
|
209
|
+
##### Description
|
|
210
|
+
|
|
211
|
+
Demonstrates using a section with \`padding="none"\` to create a full-width layout, ideal for displaying tables or other content that requires edge-to-edge rendering.
|
|
212
|
+
|
|
213
|
+
##### jsx
|
|
214
|
+
|
|
215
|
+
```jsx
|
|
216
|
+
<s-section padding="none">
|
|
217
|
+
<s-table>
|
|
218
|
+
<s-table-header-row>
|
|
219
|
+
<s-table-header listSlot="primary">Product</s-table-header>
|
|
220
|
+
<s-table-header listSlot="labeled">Price</s-table-header>
|
|
221
|
+
<s-table-header listSlot="inline">Status</s-table-header>
|
|
222
|
+
</s-table-header-row>
|
|
223
|
+
<s-table-body>
|
|
224
|
+
<s-table-row>
|
|
225
|
+
<s-table-cell>Cotton t-shirt</s-table-cell>
|
|
226
|
+
<s-table-cell>$29.99</s-table-cell>
|
|
227
|
+
<s-table-cell>
|
|
228
|
+
<s-badge tone="success">Active</s-badge>
|
|
229
|
+
</s-table-cell>
|
|
230
|
+
</s-table-row>
|
|
231
|
+
</s-table-body>
|
|
232
|
+
</s-table>
|
|
233
|
+
</s-section>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
##### html
|
|
237
|
+
|
|
238
|
+
```html
|
|
239
|
+
<s-section padding="none">
|
|
240
|
+
<s-table>
|
|
241
|
+
<s-table-header-row>
|
|
242
|
+
<s-table-header listSlot="primary">Product</s-table-header>
|
|
243
|
+
<s-table-header listSlot="labeled">Price</s-table-header>
|
|
244
|
+
<s-table-header listSlot="inline">Status</s-table-header>
|
|
245
|
+
</s-table-header-row>
|
|
246
|
+
<s-table-body>
|
|
247
|
+
<s-table-row>
|
|
248
|
+
<s-table-cell>Cotton t-shirt</s-table-cell>
|
|
249
|
+
<s-table-cell>$29.99</s-table-cell>
|
|
250
|
+
<s-table-cell><s-badge tone="success">Active</s-badge></s-table-cell>
|
|
251
|
+
</s-table-row>
|
|
252
|
+
</s-table-body>
|
|
253
|
+
</s-table>
|
|
254
|
+
</s-section>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Useful for
|
|
258
|
+
|
|
259
|
+
* Organizing your page in a logical structure based on nesting levels.
|
|
260
|
+
* Creating consistency across pages.
|
|
261
|
+
|
|
262
|
+
## Considerations
|
|
263
|
+
|
|
264
|
+
* When adding headings inside sections they automatically use a specific style, which helps keep the content organized and clear.
|
|
265
|
+
* Built-in spacing is added between nested sections, as well as between heading and content.
|
|
266
|
+
* **Level 1:** Display as responsive cards with background color, rounded corners, and shadow effects. Includes outer padding that can be removed when content like `s-table` needs to expand to the full width of the section.
|
|
267
|
+
* **Nested sections:** Don't have any background color or effects by default.
|