@warp-ds/elements 2.9.1 → 2.10.0-next.1

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.
Files changed (97) hide show
  1. package/dist/custom-elements.json +347 -284
  2. package/dist/docs/button/accessibility.md +42 -0
  3. package/dist/docs/button/api.md +63 -39
  4. package/dist/docs/button/button.md +322 -40
  5. package/dist/docs/button/examples.md +126 -0
  6. package/dist/docs/button/usage.md +89 -0
  7. package/dist/docs/modal/accessibility.md +1 -0
  8. package/dist/docs/modal/api.md +51 -0
  9. package/dist/docs/modal/examples.md +67 -0
  10. package/dist/docs/modal/modal.md +238 -0
  11. package/dist/docs/modal/usage.md +110 -0
  12. package/dist/docs/modal-footer/accessibility.md +1 -0
  13. package/dist/docs/modal-footer/api.md +11 -0
  14. package/dist/docs/modal-footer/examples.md +1 -0
  15. package/dist/docs/modal-footer/modal-footer.md +23 -0
  16. package/dist/docs/modal-footer/usage.md +1 -0
  17. package/dist/docs/modal-header/accessibility.md +1 -0
  18. package/dist/docs/modal-header/api.md +42 -0
  19. package/dist/docs/modal-header/examples.md +1 -0
  20. package/dist/docs/modal-header/modal-header.md +54 -0
  21. package/dist/docs/modal-header/usage.md +1 -0
  22. package/dist/docs/page-indicator/api.md +6 -6
  23. package/dist/docs/page-indicator/examples.md +8 -0
  24. package/dist/docs/page-indicator/page-indicator.md +23 -6
  25. package/dist/docs/page-indicator/usage.md +8 -0
  26. package/dist/docs/pagination/api.md +12 -10
  27. package/dist/docs/pagination/examples.md +20 -0
  28. package/dist/docs/pagination/pagination.md +50 -12
  29. package/dist/docs/pagination/usage.md +18 -0
  30. package/dist/docs/pill/accessibility.md +2 -0
  31. package/dist/docs/pill/api.md +10 -26
  32. package/dist/docs/pill/examples.md +23 -0
  33. package/dist/docs/pill/pill.md +43 -28
  34. package/dist/docs/pill/usage.md +8 -0
  35. package/dist/docs/radio/accessibility.md +1 -0
  36. package/dist/docs/radio/api.md +57 -0
  37. package/dist/docs/radio/examples.md +1 -0
  38. package/dist/docs/radio/radio.md +69 -0
  39. package/dist/docs/radio/usage.md +1 -0
  40. package/dist/docs/radio-group/accessibility.md +1 -0
  41. package/dist/docs/radio-group/api.md +69 -0
  42. package/dist/docs/radio-group/examples.md +68 -0
  43. package/dist/docs/radio-group/radio-group.md +311 -0
  44. package/dist/docs/radio-group/styling.md +118 -0
  45. package/dist/docs/radio-group/usage.md +44 -0
  46. package/dist/docs/select/accessibility.md +2 -0
  47. package/dist/docs/select/api.md +20 -16
  48. package/dist/docs/select/examples.md +116 -0
  49. package/dist/docs/select/select.md +168 -18
  50. package/dist/docs/select/usage.md +30 -0
  51. package/dist/index.d.ts +441 -474
  52. package/dist/packages/attention/attention.js +23 -21
  53. package/dist/packages/attention/attention.js.map +3 -3
  54. package/dist/packages/button/button.d.ts +54 -37
  55. package/dist/packages/button/button.js +17 -15
  56. package/dist/packages/button/button.js.map +3 -3
  57. package/dist/packages/button/button.react.stories.d.ts +2 -2
  58. package/dist/packages/button/react.d.ts +1 -1
  59. package/dist/packages/modal/index.d.ts +4 -4
  60. package/dist/packages/modal/index.js +4 -4
  61. package/dist/packages/modal/modal.d.ts +21 -12
  62. package/dist/packages/modal/modal.js +4 -4
  63. package/dist/packages/modal/modal.js.map +3 -3
  64. package/dist/packages/modal/modal.react.stories.d.ts +3 -3
  65. package/dist/packages/modal/modal.stories.d.ts +2 -1
  66. package/dist/packages/modal/modal.stories.js +85 -3
  67. package/dist/packages/modal/react.d.ts +2 -2
  68. package/dist/packages/modal-footer/modal-footer.d.ts +5 -3
  69. package/dist/packages/modal-footer/modal-footer.js +4 -4
  70. package/dist/packages/modal-footer/modal-footer.js.map +3 -3
  71. package/dist/packages/modal-footer/react.d.ts +1 -1
  72. package/dist/packages/modal-header/modal-header.d.ts +21 -11
  73. package/dist/packages/modal-header/modal-header.js +1 -1
  74. package/dist/packages/modal-header/modal-header.js.map +3 -3
  75. package/dist/packages/modal-header/react.d.ts +2 -2
  76. package/dist/packages/page-indicator/page-indicator.d.ts +9 -14
  77. package/dist/packages/page-indicator/page-indicator.js.map +2 -2
  78. package/dist/packages/pagination/pagination.d.ts +11 -11
  79. package/dist/packages/pagination/pagination.js.map +2 -2
  80. package/dist/packages/pill/pill.d.ts +14 -29
  81. package/dist/packages/pill/pill.js.map +2 -2
  82. package/dist/packages/pill/pill.react.stories.d.ts +2 -2
  83. package/dist/packages/pill/react.d.ts +1 -1
  84. package/dist/packages/radio/radio.d.ts +51 -13
  85. package/dist/packages/radio/radio.js +3 -3
  86. package/dist/packages/radio/radio.js.map +3 -3
  87. package/dist/packages/radio/radio.react.stories.d.ts +1 -1
  88. package/dist/packages/radio/radio.stories.d.ts +2 -2
  89. package/dist/packages/radio/react.d.ts +2 -2
  90. package/dist/packages/radio-group/radio-group.d.ts +43 -5
  91. package/dist/packages/radio-group/radio-group.js +7 -7
  92. package/dist/packages/radio-group/radio-group.js.map +3 -3
  93. package/dist/packages/radio-group/react.d.ts +4 -4
  94. package/dist/packages/select/select.d.ts +32 -48
  95. package/dist/packages/select/select.js.map +2 -2
  96. package/dist/web-types.json +349 -115
  97. package/package.json +5 -5
@@ -2,16 +2,274 @@
2
2
 
3
3
  ## Description
4
4
 
5
- Buttons are used to perform actions, widh different visuals for different needs.
5
+ Performs an action or renders a link with button styling.
6
+ Use button variants to match action priority, risk, and context.
6
7
 
7
8
  [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/buttons-button--docs)
8
9
 
9
10
  ## Usage
10
11
 
12
+ Button is used for actions. Use it when the user can submit, save, confirm, cancel, open, close, or trigger something on the current page.
13
+
14
+ Use a link instead when the user is navigating to another page. If the control should look like a button but navigate like a link, use `w-link`.
15
+
16
+ ### Basic Button
17
+
18
+ ```html
19
+ <w-button>Save</w-button>
20
+ ```
21
+
22
+ The default `variant` is `secondary` and the default `type` is `button`.
23
+
24
+ ### Variants
25
+
26
+ Choose the variant based on the action's priority and context:
27
+
28
+ - `primary`: the main action in a view or flow
29
+ - `secondary`: secondary or tertiary actions; this is the default
30
+ - `negative`: destructive or high-risk actions
31
+ - `negativeQuiet`: low-emphasis destructive actions
32
+ - `utility`: compact utility actions
33
+ - `utilityQuiet`: low-emphasis utility actions
34
+ - `quiet`: low-emphasis actions, often near other buttons
35
+ - `link`: (@deprecated) action styled like an inline link
36
+ - `pill`: circular icon-style controls
37
+ - `overlay`, `overlayQuiet`, `overlayInverted`, `overlayInvertedQuiet`: controls placed on top of media or elevated surfaces
38
+
39
+ ```html
40
+ <w-button variant="primary">Publish</w-button>
41
+ <w-button variant="secondary">Cancel</w-button>
42
+ <w-button variant="negative">Delete</w-button>
43
+ <w-button variant="utility">Filter</w-button>
44
+ ```
45
+
46
+ ### Sizes And Width
47
+
48
+ Use `small` for compact layouts. Use `full-width` when the button should fill its parent, such as in narrow mobile layouts.
49
+
50
+ ```html
51
+ <w-button variant="primary" small>Save</w-button>
52
+ <w-button variant="primary" full-width>Continue</w-button>
53
+ ```
54
+
55
+ ### Icon-Only Buttons
56
+
57
+ Use `variant="pill"` for circular icon-only controls. Include accessible text in the slotted content so the internal button has a name.
58
+
59
+ ```html
60
+ <w-button variant="pill" icon-only>
61
+ <w-icon name="Close"></w-icon>
62
+ <span class="sr-only">Close</span>
63
+ </w-button>
64
+ ```
65
+
66
+ ### Loading
67
+
68
+ Use `loading` after the user triggers an action and the action is in progress.
69
+
70
+ ```html
71
+ <w-button variant="primary" loading>Saving</w-button>
72
+ ```
73
+
74
+ Keep the button text descriptive while loading. Do not rely on the loading animation alone to explain what is happening.
75
+
76
+ ### Form Buttons
77
+
78
+ Use `type="submit"` to submit the containing form and `type="reset"` to reset it. Use `name` and `value` when the button value should be included in form handling.
79
+
80
+ ```html
81
+ <form>
82
+ <w-button type="submit" name="intent" value="save">Save</w-button>
83
+ <w-button type="reset">Reset</w-button>
84
+ </form>
85
+ ```
86
+
87
+ ### Link Styled As Button
88
+
89
+ Use an `a` tag if you need a link that looks and behaves like a link, do not use `w-button`.
90
+
91
+ ### Link Styled As Button
92
+
93
+ Use `w-link` if you need a link that looks like a button.
94
+
95
+ ### Disabled Actions
96
+
97
+ Avoid disabled buttons where possible. Disabled controls often make it harder for users to understand what is missing or how to continue.
98
+
99
+ Prefer an enabled button with clear validation or explanatory feedback near the related field.
100
+
11
101
  ## Accessibility
12
102
 
103
+ Buttons must have a clear accessible name and should describe the action they perform.
104
+
105
+ ### Use Descriptive Text
106
+
107
+ Prefer visible text that names the action.
108
+
109
+ ```html
110
+ <w-button>Save changes</w-button>
111
+ ```
112
+
113
+ Avoid vague labels when the action is not obvious from context.
114
+
115
+ ```html
116
+ <!-- Avoid -->
117
+ <w-button>OK</w-button>
118
+ ```
119
+
120
+ ### Icon-Only Buttons
121
+
122
+ If a button does not have visible text, include text for assistive technologies in the slotted content.
123
+
124
+ ```html
125
+ <w-button variant="pill">
126
+ <w-icon name="Close"></w-icon>
127
+ <span class="sr-only">Close</span>
128
+ </w-button>
129
+ ```
130
+
131
+ The accessible text should describe the action, not the icon shape.
132
+
133
+ ### Disabled Buttons
134
+
135
+ Avoid disabled buttons. A disabled control can prevent keyboard users from reaching it and often does not explain what must happen before the action becomes available.
136
+
137
+ Prefer keeping the button available and showing validation or explanatory feedback when the user tries to continue.
138
+
139
+ ### Button Or Link
140
+
141
+ Use a w-button for actions on the current page. Use a w-link for navigation.
142
+
143
+ For backwards compatibility, if `href` is set, `w-button` renders a link with button styling. The accessible behavior is link behavior, even though the component looks like a button. This is deprecated behaviour and you should instead use the w-link component if you need to render a link that looks like a button.
144
+
13
145
  ## Examples
14
146
 
147
+ ### Primary
148
+
149
+ <elements-example>
150
+
151
+ ```html
152
+ <w-button variant="primary">Publish</w-button>
153
+ ```
154
+
155
+ </elements-example>
156
+
157
+ ### Secondary
158
+
159
+ <elements-example>
160
+
161
+ ```html
162
+ <w-button variant="secondary">Cancel</w-button>
163
+ ```
164
+
165
+ </elements-example>
166
+
167
+ ### Negative
168
+
169
+ <elements-example>
170
+
171
+ ```html
172
+ <w-button variant="negative">Delete</w-button>
173
+ ```
174
+
175
+ </elements-example>
176
+
177
+ ### Utility
178
+
179
+ <elements-example>
180
+
181
+ ```html
182
+ <w-button variant="utility">Filter</w-button>
183
+ ```
184
+
185
+ </elements-example>
186
+
187
+ ### Quiet
188
+
189
+ <elements-example>
190
+
191
+ ```html
192
+ <w-button variant="quiet">Skip</w-button>
193
+ ```
194
+
195
+ </elements-example>
196
+
197
+ ### Icon Only
198
+
199
+ <elements-example>
200
+
201
+ ```html
202
+ <w-button variant="pill" icon-only>
203
+ <w-icon name="Close"></w-icon>
204
+ <span class="sr-only">Close</span>
205
+ </w-button>
206
+ ```
207
+
208
+ </elements-example>
209
+
210
+ ### Small
211
+
212
+ <elements-example>
213
+
214
+ ```html
215
+ <w-button variant="primary" small>Save</w-button>
216
+ ```
217
+
218
+ </elements-example>
219
+
220
+ ### Full Width
221
+
222
+ <elements-example>
223
+
224
+ ```html
225
+ <w-button variant="primary" full-width>Continue</w-button>
226
+ ```
227
+
228
+ </elements-example>
229
+
230
+ ### Loading
231
+
232
+ <elements-example>
233
+
234
+ ```html
235
+ <w-button variant="primary" loading>Saving</w-button>
236
+ ```
237
+
238
+ </elements-example>
239
+
240
+ ### Link Styled As Button
241
+
242
+ <elements-example>
243
+
244
+ ```html
245
+ <w-button href="/messages/new" variant="primary">New message</w-button>
246
+ ```
247
+
248
+ </elements-example>
249
+
250
+ ### External Link
251
+
252
+ <elements-example>
253
+
254
+ ```html
255
+ <w-button href="https://example.com" target="_blank">Visit example</w-button>
256
+ ```
257
+
258
+ </elements-example>
259
+
260
+ ### Form Actions
261
+
262
+ <elements-example>
263
+
264
+ ```html
265
+ <form>
266
+ <w-button type="submit" name="intent" value="save">Save</w-button>
267
+ <w-button type="reset">Reset</w-button>
268
+ </form>
269
+ ```
270
+
271
+ </elements-example>
272
+
15
273
  ## `<w-button>` API
16
274
 
17
275
  Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
@@ -20,36 +278,31 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
20
278
 
21
279
  | Name | Type | Default | Summary |
22
280
  |-|-|-|-|
23
- | ariaValueTextLoading (JS only) | `unknown` | `-` | - |
24
- | autofocus | `boolean` | `false` | - |
25
- | button-class | `string` | `-` | **Deprecated**: This class is applied inside the shadow DOM and is unlikely to have the desired effect. Use attributes or CSS variables to customize the appearance of the button. |
26
- | disabled | `boolean` | `false` | - |
27
- | full-width | `boolean` | `false` | - |
28
- | href | `string` | `-` | - |
29
- | icon-only | `boolean` | `false` | - |
30
- | loading | `boolean` | `false` | - |
31
- | name | `string` | `-` | - |
32
- | quiet | `boolean` | `false` | **Deprecated**: Use `variant="quiet"` instead |
33
- | rel | `string` | `-` | - |
34
- | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
35
- | small | `boolean` | `false` | - |
36
- | target | `string` | `-` | - |
37
- | type | [`ButtonType`](#buttontype) | `-` | - |
38
- | value | `string` | `-` | - |
39
- | variant | [`ButtonVariant`](#buttonvariant) | `-` | - |
281
+ | autofocus | `boolean` | `false` | Focuses the button when it is first rendered. |
282
+ | button-class | `string` | `-` | Deprecated class applied to the internal control. **Deprecated**: This class is applied inside the shadow DOM and is unlikely to have the desired effect. Use attributes or CSS variables to customize the appearance of the button. |
283
+ | command | `string` | `-` | The [command HTML attribute](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API#html_attributes) for Invoker Commands. |
284
+ | commandfor | `string` | `-` | The [commandfor HTML attribute](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API#html_attributes) for Invoker Commands. |
285
+ | disabled | `boolean` | `false` | Visually disables the button. |
286
+ | full-width | `boolean` | `false` | Makes the button fill its parent width. |
287
+ | href | `string` | `-` | URL for rendering the button as a link. |
288
+ | icon-only | `boolean` | `false` | Marks the button as icon-only. |
289
+ | loading | `boolean` | `false` | Shows the loading state. |
290
+ | name | `string` | `-` | Form control name. |
291
+ | quiet | `boolean` | `false` | Deprecated quiet visual treatment flag. **Deprecated**: Use `variant="quiet"` instead |
292
+ | rel | `string` | `-` | Link relationship. |
293
+ | shadowRootOptions (JS only) | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | Shadow root configuration. |
294
+ | small | `boolean` | `false` | Renders the compact button size. |
295
+ | target | `string` | `-` | Link browsing context. |
296
+ | type | [`ButtonType`](#buttontype) | `-` | Native button type. |
297
+ | value | `string` | `-` | Form control value. |
298
+ | variant | [`ButtonVariant`](#buttonvariant) | `-` | Visual style of the button. |
40
299
 
41
300
  ### Property Details
42
301
 
43
- #### ariaValueTextLoading (JS only)
44
-
45
-
46
-
47
- - Type: `unknown`
48
- - Default: `-`
49
-
50
302
  #### autofocus
51
303
 
52
-
304
+ Focuses the button when it is first rendered.
305
+ Applies only when the component renders a native button. Link buttons with `href` do not autofocus through this component.
53
306
 
54
307
  - Type: `boolean`
55
308
  - Default: `false`
@@ -58,49 +311,70 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
58
311
 
59
312
  **Deprecated**: This class is applied inside the shadow DOM and is unlikely to have the desired effect. Use attributes or CSS variables to customize the appearance of the button.
60
313
 
314
+ Deprecated class applied to the internal control
315
+ This class is applied inside the shadow DOM and is unlikely to have the desired effect. Use attributes or CSS variables to customize the button appearance.
61
316
 
317
+ - Type: `string`
318
+ - Default: `-`
319
+
320
+ #### command
321
+
322
+ The [command HTML attribute](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API#html_attributes) for Invoker Commands.
62
323
 
63
324
  - Type: `string`
64
325
  - Default: `-`
65
326
 
66
- #### disabled
327
+ #### commandfor
328
+
329
+ The [commandfor HTML attribute](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API#html_attributes) for Invoker Commands.
330
+
331
+ - Type: `string`
332
+ - Default: `-`
67
333
 
334
+ #### disabled
68
335
 
336
+ Visually disables the button.
337
+ Disabled buttons are discouraged because they can hide the reason an action is unavailable.
69
338
 
70
339
  - Type: `boolean`
71
340
  - Default: `false`
72
341
 
73
342
  #### full-width
74
343
 
75
-
344
+ Makes the button fill its parent width.
345
+ Useful in narrow layouts where the button should span the available inline space.
76
346
 
77
347
  - Type: `boolean`
78
348
  - Default: `false`
79
349
 
80
350
  #### href
81
351
 
82
-
352
+ URL for rendering the button as a link.
353
+ When set, the component renders `w-link` instead of a native `button`.
83
354
 
84
355
  - Type: `string`
85
356
  - Default: `-`
86
357
 
87
358
  #### icon-only
88
359
 
89
-
360
+ Marks the button as icon-only.
361
+ Use this when the button has no visible text. Include accessible text in the slotted content so the internal button has a name.
90
362
 
91
363
  - Type: `boolean`
92
364
  - Default: `false`
93
365
 
94
366
  #### loading
95
367
 
96
-
368
+ Shows the loading state.
369
+ Use after the user has triggered an action and the action is in progress.
97
370
 
98
371
  - Type: `boolean`
99
372
  - Default: `false`
100
373
 
101
374
  #### name
102
375
 
103
-
376
+ Form control name.
377
+ Used when the button participates in form handling.
104
378
 
105
379
  - Type: `string`
106
380
  - Default: `-`
@@ -109,56 +383,64 @@ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScr
109
383
 
110
384
  **Deprecated**: Use `variant="quiet"` instead
111
385
 
112
-
386
+ Deprecated quiet visual treatment flag
387
+ Use `variant="quiet"` instead.
113
388
 
114
389
  - Type: `boolean`
115
390
  - Default: `false`
116
391
 
117
392
  #### rel
118
393
 
119
-
394
+ Link relationship.
395
+ Passed to the rendered link when `href` is set. If `target="_blank"` is set and `rel` is omitted, `noopener` is used.
120
396
 
121
397
  - Type: `string`
122
398
  - Default: `-`
123
399
 
124
400
  #### shadowRootOptions (JS only)
125
401
 
126
-
402
+ Shadow root configuration.
403
+ Delegates focus from the host to the internal control.
127
404
 
128
405
  - Type: `object`
129
406
  - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
130
407
 
131
408
  #### small
132
409
 
133
-
410
+ Renders the compact button size.
411
+ Use this in dense layouts where the default button size is too large.
134
412
 
135
413
  - Type: `boolean`
136
414
  - Default: `false`
137
415
 
138
416
  #### target
139
417
 
140
-
418
+ Link browsing context.
419
+ Passed to the rendered link when `href` is set.
141
420
 
142
421
  - Type: `string`
143
422
  - Default: `-`
144
423
 
145
424
  #### type
146
425
 
147
-
426
+ Native button type.
427
+ Controls whether the internal button behaves as a regular button, submits a form, or resets a form. Defaults to `button`.
148
428
 
149
429
  - Type: [`ButtonType`](#buttontype)
150
430
  - Default: `-`
151
431
 
152
432
  #### value
153
433
 
154
-
434
+ Form control value.
435
+ Used with `name` when the button participates in form handling. Resets to its initial value when the form is reset.
155
436
 
156
437
  - Type: `string`
157
438
  - Default: `-`
158
439
 
159
440
  #### variant
160
441
 
161
-
442
+ Visual style of the button.
443
+ Defaults to `secondary`. Use the variant that matches the action priority, risk, and placement.
162
444
 
163
445
  - Type: [`ButtonVariant`](#buttonvariant)
164
446
  - Default: `-`
@@ -1 +1,127 @@
1
1
  ## Examples
2
+
3
+ ### Primary
4
+
5
+ <elements-example>
6
+
7
+ ```html
8
+ <w-button variant="primary">Publish</w-button>
9
+ ```
10
+
11
+ </elements-example>
12
+
13
+ ### Secondary
14
+
15
+ <elements-example>
16
+
17
+ ```html
18
+ <w-button variant="secondary">Cancel</w-button>
19
+ ```
20
+
21
+ </elements-example>
22
+
23
+ ### Negative
24
+
25
+ <elements-example>
26
+
27
+ ```html
28
+ <w-button variant="negative">Delete</w-button>
29
+ ```
30
+
31
+ </elements-example>
32
+
33
+ ### Utility
34
+
35
+ <elements-example>
36
+
37
+ ```html
38
+ <w-button variant="utility">Filter</w-button>
39
+ ```
40
+
41
+ </elements-example>
42
+
43
+ ### Quiet
44
+
45
+ <elements-example>
46
+
47
+ ```html
48
+ <w-button variant="quiet">Skip</w-button>
49
+ ```
50
+
51
+ </elements-example>
52
+
53
+ ### Icon Only
54
+
55
+ <elements-example>
56
+
57
+ ```html
58
+ <w-button variant="pill" icon-only>
59
+ <w-icon name="Close"></w-icon>
60
+ <span class="sr-only">Close</span>
61
+ </w-button>
62
+ ```
63
+
64
+ </elements-example>
65
+
66
+ ### Small
67
+
68
+ <elements-example>
69
+
70
+ ```html
71
+ <w-button variant="primary" small>Save</w-button>
72
+ ```
73
+
74
+ </elements-example>
75
+
76
+ ### Full Width
77
+
78
+ <elements-example>
79
+
80
+ ```html
81
+ <w-button variant="primary" full-width>Continue</w-button>
82
+ ```
83
+
84
+ </elements-example>
85
+
86
+ ### Loading
87
+
88
+ <elements-example>
89
+
90
+ ```html
91
+ <w-button variant="primary" loading>Saving</w-button>
92
+ ```
93
+
94
+ </elements-example>
95
+
96
+ ### Link Styled As Button
97
+
98
+ <elements-example>
99
+
100
+ ```html
101
+ <w-button href="/messages/new" variant="primary">New message</w-button>
102
+ ```
103
+
104
+ </elements-example>
105
+
106
+ ### External Link
107
+
108
+ <elements-example>
109
+
110
+ ```html
111
+ <w-button href="https://example.com" target="_blank">Visit example</w-button>
112
+ ```
113
+
114
+ </elements-example>
115
+
116
+ ### Form Actions
117
+
118
+ <elements-example>
119
+
120
+ ```html
121
+ <form>
122
+ <w-button type="submit" name="intent" value="save">Save</w-button>
123
+ <w-button type="reset">Reset</w-button>
124
+ </form>
125
+ ```
126
+
127
+ </elements-example>
@@ -1 +1,90 @@
1
1
  ## Usage
2
+
3
+ Button is used for actions. Use it when the user can submit, save, confirm, cancel, open, close, or trigger something on the current page.
4
+
5
+ Use a link instead when the user is navigating to another page. If the control should look like a button but navigate like a link, use `w-link`.
6
+
7
+ ### Basic Button
8
+
9
+ ```html
10
+ <w-button>Save</w-button>
11
+ ```
12
+
13
+ The default `variant` is `secondary` and the default `type` is `button`.
14
+
15
+ ### Variants
16
+
17
+ Choose the variant based on the action's priority and context:
18
+
19
+ - `primary`: the main action in a view or flow
20
+ - `secondary`: secondary or tertiary actions; this is the default
21
+ - `negative`: destructive or high-risk actions
22
+ - `negativeQuiet`: low-emphasis destructive actions
23
+ - `utility`: compact utility actions
24
+ - `utilityQuiet`: low-emphasis utility actions
25
+ - `quiet`: low-emphasis actions, often near other buttons
26
+ - `link`: (@deprecated) action styled like an inline link
27
+ - `pill`: circular icon-style controls
28
+ - `overlay`, `overlayQuiet`, `overlayInverted`, `overlayInvertedQuiet`: controls placed on top of media or elevated surfaces
29
+
30
+ ```html
31
+ <w-button variant="primary">Publish</w-button>
32
+ <w-button variant="secondary">Cancel</w-button>
33
+ <w-button variant="negative">Delete</w-button>
34
+ <w-button variant="utility">Filter</w-button>
35
+ ```
36
+
37
+ ### Sizes And Width
38
+
39
+ Use `small` for compact layouts. Use `full-width` when the button should fill its parent, such as in narrow mobile layouts.
40
+
41
+ ```html
42
+ <w-button variant="primary" small>Save</w-button>
43
+ <w-button variant="primary" full-width>Continue</w-button>
44
+ ```
45
+
46
+ ### Icon-Only Buttons
47
+
48
+ Use `variant="pill"` for circular icon-only controls. Include accessible text in the slotted content so the internal button has a name.
49
+
50
+ ```html
51
+ <w-button variant="pill" icon-only>
52
+ <w-icon name="Close"></w-icon>
53
+ <span class="sr-only">Close</span>
54
+ </w-button>
55
+ ```
56
+
57
+ ### Loading
58
+
59
+ Use `loading` after the user triggers an action and the action is in progress.
60
+
61
+ ```html
62
+ <w-button variant="primary" loading>Saving</w-button>
63
+ ```
64
+
65
+ Keep the button text descriptive while loading. Do not rely on the loading animation alone to explain what is happening.
66
+
67
+ ### Form Buttons
68
+
69
+ Use `type="submit"` to submit the containing form and `type="reset"` to reset it. Use `name` and `value` when the button value should be included in form handling.
70
+
71
+ ```html
72
+ <form>
73
+ <w-button type="submit" name="intent" value="save">Save</w-button>
74
+ <w-button type="reset">Reset</w-button>
75
+ </form>
76
+ ```
77
+
78
+ ### Link Styled As Button
79
+
80
+ Use an `a` tag if you need a link that looks and behaves like a link, do not use `w-button`.
81
+
82
+ ### Link Styled As Button
83
+
84
+ Use `w-link` if you need a link that looks like a button.
85
+
86
+ ### Disabled Actions
87
+
88
+ Avoid disabled buttons where possible. Disabled controls often make it harder for users to understand what is missing or how to continue.
89
+
90
+ Prefer an enabled button with clear validation or explanatory feedback near the related field.
@@ -0,0 +1 @@
1
+ ## Accessibility