@warp-ds/elements 2.9.2-next.1 → 2.10.0-next.10

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