@gitlab/ui 114.1.0 → 114.1.2

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 (141) hide show
  1. package/dist/components/base/breadcrumb/breadcrumb.js +4 -16
  2. package/dist/index.css +1 -1
  3. package/dist/index.css.map +1 -1
  4. package/package.json +7 -26
  5. package/src/components/base/breadcrumb/breadcrumb.scss +18 -2
  6. package/src/components/base/breadcrumb/breadcrumb.vue +4 -17
  7. package/CHANGELOG.md +0 -13139
  8. package/src/vendor/bootstrap/LICENSE +0 -11
  9. package/src/vendor/bootstrap-vue/LICENSE +0 -11
  10. package/src/vendor/bootstrap-vue/package.json +0 -144
  11. package/src/vendor/bootstrap-vue/src/components/button/MODIFICATIONS.md +0 -16
  12. package/src/vendor/bootstrap-vue/src/components/button/README.md +0 -240
  13. package/src/vendor/bootstrap-vue/src/components/button/button-close.spec.js +0 -210
  14. package/src/vendor/bootstrap-vue/src/components/button/button.spec.js +0 -349
  15. package/src/vendor/bootstrap-vue/src/components/button/package.json +0 -105
  16. package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +0 -730
  17. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.spec.js +0 -58
  18. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.spec.js +0 -110
  19. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.spec.js +0 -94
  20. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.spec.js +0 -73
  21. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.spec.js +0 -117
  22. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.spec.js +0 -147
  23. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.spec.js +0 -59
  24. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.spec.js +0 -1121
  25. package/src/vendor/bootstrap-vue/src/components/dropdown/package.json +0 -368
  26. package/src/vendor/bootstrap-vue/src/components/form/README.md +0 -365
  27. package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.spec.js +0 -170
  28. package/src/vendor/bootstrap-vue/src/components/form/form-text.spec.js +0 -93
  29. package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.spec.js +0 -157
  30. package/src/vendor/bootstrap-vue/src/components/form/form.spec.js +0 -97
  31. package/src/vendor/bootstrap-vue/src/components/form/package.json +0 -112
  32. package/src/vendor/bootstrap-vue/src/components/form-checkbox/README.md +0 -691
  33. package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox-group.spec.js +0 -525
  34. package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox.spec.js +0 -922
  35. package/src/vendor/bootstrap-vue/src/components/form-checkbox/package.json +0 -172
  36. package/src/vendor/bootstrap-vue/src/components/form-group/README.md +0 -339
  37. package/src/vendor/bootstrap-vue/src/components/form-group/form-group.spec.js +0 -477
  38. package/src/vendor/bootstrap-vue/src/components/form-group/package.json +0 -183
  39. package/src/vendor/bootstrap-vue/src/components/form-radio/README.md +0 -437
  40. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.spec.js +0 -357
  41. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.spec.js +0 -587
  42. package/src/vendor/bootstrap-vue/src/components/form-radio/package.json +0 -162
  43. package/src/vendor/bootstrap-vue/src/components/form-select/README.md +0 -504
  44. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.spec.js +0 -138
  45. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.spec.js +0 -75
  46. package/src/vendor/bootstrap-vue/src/components/form-select/form-select.spec.js +0 -723
  47. package/src/vendor/bootstrap-vue/src/components/form-select/package.json +0 -132
  48. package/src/vendor/bootstrap-vue/src/components/form-textarea/README.md +0 -453
  49. package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.spec.js +0 -1000
  50. package/src/vendor/bootstrap-vue/src/components/form-textarea/package.json +0 -122
  51. package/src/vendor/bootstrap-vue/src/components/layout/README.md +0 -791
  52. package/src/vendor/bootstrap-vue/src/components/layout/col.spec.js +0 -192
  53. package/src/vendor/bootstrap-vue/src/components/layout/form-row.spec.js +0 -45
  54. package/src/vendor/bootstrap-vue/src/components/layout/package.json +0 -99
  55. package/src/vendor/bootstrap-vue/src/components/link/README.md +0 -76
  56. package/src/vendor/bootstrap-vue/src/components/link/link.spec.js +0 -434
  57. package/src/vendor/bootstrap-vue/src/components/link/package.json +0 -57
  58. package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +0 -30
  59. package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -1067
  60. package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.spec.js +0 -82
  61. package/src/vendor/bootstrap-vue/src/components/modal/modal.spec.js +0 -1418
  62. package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -544
  63. package/src/vendor/bootstrap-vue/src/components/nav/README.md +0 -362
  64. package/src/vendor/bootstrap-vue/src/components/nav/nav-item.spec.js +0 -127
  65. package/src/vendor/bootstrap-vue/src/components/nav/nav.spec.js +0 -177
  66. package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -73
  67. package/src/vendor/bootstrap-vue/src/components/popover/README.md +0 -919
  68. package/src/vendor/bootstrap-vue/src/components/popover/package.json +0 -261
  69. package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -198
  70. package/src/vendor/bootstrap-vue/src/components/table/README.md +0 -3157
  71. package/src/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.spec.js +0 -112
  72. package/src/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.spec.js +0 -93
  73. package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -1763
  74. package/src/vendor/bootstrap-vue/src/components/table/table-busy.spec.js +0 -150
  75. package/src/vendor/bootstrap-vue/src/components/table/table-caption.spec.js +0 -176
  76. package/src/vendor/bootstrap-vue/src/components/table/table-colgroup.spec.js +0 -81
  77. package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +0 -409
  78. package/src/vendor/bootstrap-vue/src/components/table/table-item-formatter.spec.js +0 -56
  79. package/src/vendor/bootstrap-vue/src/components/table/table-lite.spec.js +0 -682
  80. package/src/vendor/bootstrap-vue/src/components/table/table-pagination.spec.js +0 -133
  81. package/src/vendor/bootstrap-vue/src/components/table/table-primarykey.spec.js +0 -83
  82. package/src/vendor/bootstrap-vue/src/components/table/table-provider.spec.js +0 -411
  83. package/src/vendor/bootstrap-vue/src/components/table/table-row-details.spec.js +0 -459
  84. package/src/vendor/bootstrap-vue/src/components/table/table-selectable.spec.js +0 -1182
  85. package/src/vendor/bootstrap-vue/src/components/table/table-simple.spec.js +0 -206
  86. package/src/vendor/bootstrap-vue/src/components/table/table-sorting.spec.js +0 -858
  87. package/src/vendor/bootstrap-vue/src/components/table/table-sticky-column.spec.js +0 -377
  88. package/src/vendor/bootstrap-vue/src/components/table/table-tbody-bottom-row.spec.js +0 -94
  89. package/src/vendor/bootstrap-vue/src/components/table/table-tbody-row-events.spec.js +0 -529
  90. package/src/vendor/bootstrap-vue/src/components/table/table-tbody-top-row.spec.js +0 -88
  91. package/src/vendor/bootstrap-vue/src/components/table/table-tbody-transition.spec.js +0 -83
  92. package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-custom.spec.js +0 -91
  93. package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-events.spec.js +0 -137
  94. package/src/vendor/bootstrap-vue/src/components/table/table-thead-events.spec.js +0 -155
  95. package/src/vendor/bootstrap-vue/src/components/table/table-thead-top.spec.js +0 -96
  96. package/src/vendor/bootstrap-vue/src/components/table/table.spec.js +0 -692
  97. package/src/vendor/bootstrap-vue/src/components/tabs/README.md +0 -433
  98. package/src/vendor/bootstrap-vue/src/components/tabs/package.json +0 -205
  99. package/src/vendor/bootstrap-vue/src/components/tabs/tab.spec.js +0 -330
  100. package/src/vendor/bootstrap-vue/src/components/tabs/tabs.spec.js +0 -778
  101. package/src/vendor/bootstrap-vue/src/components/toast/README.md +0 -655
  102. package/src/vendor/bootstrap-vue/src/components/toast/helpers/bv-toast.spec.js +0 -117
  103. package/src/vendor/bootstrap-vue/src/components/toast/package.json +0 -184
  104. package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +0 -294
  105. package/src/vendor/bootstrap-vue/src/components/toast/toaster.spec.js +0 -77
  106. package/src/vendor/bootstrap-vue/src/components/tooltip/README.md +0 -559
  107. package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -258
  108. package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +0 -1240
  109. package/src/vendor/bootstrap-vue/src/components/transition/package.json +0 -5
  110. package/src/vendor/bootstrap-vue/src/components/transporter/package.json +0 -5
  111. package/src/vendor/bootstrap-vue/src/components/transporter/transporter.spec.js +0 -85
  112. package/src/vendor/bootstrap-vue/src/directives/modal/modal.spec.js +0 -191
  113. package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -521
  114. package/src/vendor/bootstrap-vue/src/directives/tooltip/package.json +0 -131
  115. package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +0 -190
  116. package/src/vendor/bootstrap-vue/src/directives/visible/README.md +0 -244
  117. package/src/vendor/bootstrap-vue/src/directives/visible/package.json +0 -24
  118. package/src/vendor/bootstrap-vue/src/mixins/attrs.spec.js +0 -194
  119. package/src/vendor/bootstrap-vue/src/mixins/click-out.spec.js +0 -52
  120. package/src/vendor/bootstrap-vue/src/mixins/focus-in.spec.js +0 -53
  121. package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.spec.js +0 -117
  122. package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.spec.js +0 -77
  123. package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.spec.js +0 -115
  124. package/src/vendor/bootstrap-vue/src/mixins/listeners.spec.js +0 -245
  125. package/src/vendor/bootstrap-vue/src/utils/bv-event.class.spec.js +0 -66
  126. package/src/vendor/bootstrap-vue/src/utils/clone-deep.spec.js +0 -70
  127. package/src/vendor/bootstrap-vue/src/utils/config.spec.js +0 -169
  128. package/src/vendor/bootstrap-vue/src/utils/css-escape.spec.js +0 -82
  129. package/src/vendor/bootstrap-vue/src/utils/dom.spec.js +0 -291
  130. package/src/vendor/bootstrap-vue/src/utils/events.spec.js +0 -41
  131. package/src/vendor/bootstrap-vue/src/utils/get.spec.js +0 -109
  132. package/src/vendor/bootstrap-vue/src/utils/inspect.spec.js +0 -251
  133. package/src/vendor/bootstrap-vue/src/utils/loose-equal.spec.js +0 -203
  134. package/src/vendor/bootstrap-vue/src/utils/normalize-slot.spec.js +0 -63
  135. package/src/vendor/bootstrap-vue/src/utils/number.spec.js +0 -72
  136. package/src/vendor/bootstrap-vue/src/utils/object.spec.js +0 -61
  137. package/src/vendor/bootstrap-vue/src/utils/props.spec.js +0 -112
  138. package/src/vendor/bootstrap-vue/src/utils/router.spec.js +0 -248
  139. package/src/vendor/bootstrap-vue/src/utils/string.spec.js +0 -65
  140. package/src/vendor/bootstrap-vue/src/utils/stringify-object-values.spec.js +0 -47
  141. package/src/vendor/bootstrap-vue/src/utils/warn.spec.js +0 -54
@@ -1,691 +0,0 @@
1
- # Form Checkbox
2
-
3
- > For cross browser consistency, `<b-form-checkbox-group>` and `<b-form-checkbox>` use Bootstrap's
4
- > custom checkbox input to replace the browser default checkbox input. It is built on top of
5
- > semantic and accessible markup, so it is a solid replacement for the default checkbox input.
6
-
7
- **Example 1:** Single checkbox
8
-
9
- ```html
10
- <template>
11
- <div>
12
- <b-form-checkbox
13
- id="checkbox-1"
14
- v-model="status"
15
- name="checkbox-1"
16
- value="accepted"
17
- unchecked-value="not_accepted"
18
- >
19
- I accept the terms and use
20
- </b-form-checkbox>
21
-
22
- <div>State: <strong>{{ status }}</strong></div>
23
- </div>
24
- </template>
25
-
26
- <script>
27
- export default {
28
- data() {
29
- return {
30
- status: 'not_accepted'
31
- }
32
- }
33
- }
34
- </script>
35
-
36
- <!-- b-form-checkbox.vue -->
37
- ```
38
-
39
- **Example 2:** Multiple choice checkboxes
40
-
41
- ```html
42
- <template>
43
- <div>
44
- <b-form-group label="Using options array:" v-slot="{ ariaDescribedby }">
45
- <b-form-checkbox-group
46
- id="checkbox-group-1"
47
- v-model="selected"
48
- :options="options"
49
- :aria-describedby="ariaDescribedby"
50
- name="flavour-1"
51
- ></b-form-checkbox-group>
52
- </b-form-group>
53
-
54
- <b-form-group label="Using sub-components:" v-slot="{ ariaDescribedby }">
55
- <b-form-checkbox-group
56
- id="checkbox-group-2"
57
- v-model="selected"
58
- :aria-describedby="ariaDescribedby"
59
- name="flavour-2"
60
- >
61
- <b-form-checkbox value="orange">Orange</b-form-checkbox>
62
- <b-form-checkbox value="apple">Apple</b-form-checkbox>
63
- <b-form-checkbox value="pineapple">Pineapple</b-form-checkbox>
64
- <b-form-checkbox value="grape">Grape</b-form-checkbox>
65
- </b-form-checkbox-group>
66
- </b-form-group>
67
-
68
- <div>Selected: <strong>{{ selected }}</strong></div>
69
- </div>
70
- </template>
71
-
72
- <script>
73
- export default {
74
- data() {
75
- return {
76
- selected: [], // Must be an array reference!
77
- options: [
78
- { text: 'Orange', value: 'orange' },
79
- { text: 'Apple', value: 'apple' },
80
- { text: 'Pineapple', value: 'pineapple' },
81
- { text: 'Grape', value: 'grape' }
82
- ]
83
- }
84
- }
85
- }
86
- </script>
87
-
88
- <!-- b-form-checkbox-multiple.vue -->
89
- ```
90
-
91
- Feel free to mix and match `options` prop and `<b-form-checkbox>` in `<b-form-checkbox-group>`.
92
- Manually placed `<b-form-checkbox>` inputs will appear _below_ any checkbox inputs generated by the
93
- `options` prop. To have them appear _above_ the inputs generated by `options`, place them in the
94
- named slot `first`.
95
-
96
- ## Checkbox group options array
97
-
98
- `options` can be an array of strings or objects. Available fields:
99
-
100
- - **`value`** The selected value which will be set on `v-model`
101
- - **`disabled`** Disables item for selection
102
- - **`text`** Display text, or **`html`** Display basic inline html
103
-
104
- `value` can be a string, number, or simple object. Avoid using complex types in values.
105
-
106
- If both `html` and `text` are provided, `html` will take precedence. Only basic/native HTML is
107
- supported in the `html` field (components will not work). Note that not all browsers will render
108
- inline html (i.e. `<i>`, `<strong>`, etc.) inside `<option>` elements of a `<select>`.
109
-
110
- <p class="alert alert-danger">
111
- <strong>Be cautious</strong> of placing user supplied content in the <code>html</code> field,
112
- as it may make you vulnerable to
113
- <a class="alert-link" href="https://en.wikipedia.org/wiki/Cross-site_scripting">
114
- <abbr title="Cross Site Scripting Attacks">XSS attacks</abbr></a>, if you do not first
115
- <a class="alert-link" href="https://en.wikipedia.org/wiki/HTML_sanitization">sanitize</a> the
116
- user supplied string.
117
- </p>
118
-
119
- <!-- eslint-disable no-unused-vars -->
120
-
121
- ```js
122
- const options = ['A', 'B', 'C', { text: 'D', value: { d: 1 }, disabled: true }, 'E', 'F']
123
- ```
124
-
125
- If an array entry is a string, it will be used for both the generated `value` and `text` fields.
126
-
127
- You can mix using strings and [objects](#options-as-an-array-of-objects) in the array.
128
-
129
- Internally, BootstrapVue will convert the above array to the following array (the
130
- [array of objects](#options-as-an-array-of-objects)) format:
131
-
132
- <!-- eslint-disable no-unused-vars -->
133
-
134
- ```js
135
- const options = [
136
- { text: 'A', value: 'A', disabled: false },
137
- { text: 'B', value: 'B', disabled: false },
138
- { text: 'C', value: 'C', disabled: false },
139
- { text: 'D', value: { d: 1 }, disabled: true },
140
- { text: 'E', value: 'E', disabled: false },
141
- { text: 'F', value: 'F', disabled: false }
142
- ]
143
- ```
144
-
145
- ### Options as an array of objects
146
-
147
- <!-- eslint-disable no-unused-vars -->
148
-
149
- ```js
150
- const options = [
151
- { text: 'Item 1', value: 'first' },
152
- { text: 'Item 2', value: 'second' },
153
- { html: '<b>Item</b> 3', value: 'third', disabled: true },
154
- { text: 'Item 4' },
155
- { text: 'Item 5', value: { foo: 'bar', baz: true } }
156
- ]
157
- ```
158
-
159
- If `value` is missing, then `text` will be used as both the `value` and `text` fields. If you use
160
- the `html` property, you **must** supply a `value` property.
161
-
162
- Internally, BootstrapVue will convert the above array to the following array (the
163
- [array of objects](#options-as-an-array-of-objects)) format:
164
-
165
- <!-- eslint-disable no-unused-vars -->
166
-
167
- ```js
168
- const options = [
169
- { text: 'Item 1', value: 'first', disabled: false },
170
- { text: 'Item 2', value: 'second', disabled: false },
171
- { html: '<b>Item</b> 3', value: 'third', disabled: true },
172
- { text: 'Item 4', value: 'Item 4', disabled: false },
173
- { text: 'Item 5', value: 'E', disabled: false }
174
- ]
175
- ```
176
-
177
- ### Changing the option field names
178
-
179
- If you want to customize the field property names (for example using `name` field for display
180
- `text`) you can easily change them by setting the `text-field`, `html-field`, `value-field`, and
181
- `disabled-field` props to a string that contains the property name you would like to use:
182
-
183
- ```html
184
- <template>
185
- <div>
186
- <b-form-checkbox-group
187
- v-model="selected"
188
- :options="options"
189
- class="mb-3"
190
- value-field="item"
191
- text-field="name"
192
- disabled-field="notEnabled"
193
- ></b-form-checkbox-group>
194
- <div class="mt-3">Selected: <strong>{{ selected }}</strong></div>
195
- </div>
196
- </template>
197
-
198
- <script>
199
- export default {
200
- data() {
201
- return {
202
- selected: [],
203
- options: [
204
- { item: 'A', name: 'Option A' },
205
- { item: 'B', name: 'Option B' },
206
- { item: 'D', name: 'Option C', notEnabled: true },
207
- { item: { d: 1 }, name: 'Option D' }
208
- ]
209
- }
210
- }
211
- }
212
- </script>
213
-
214
- <!-- b-form-checkbox-group-options-fields.vue -->
215
- ```
216
-
217
- ## Inline and stacked checkboxes
218
-
219
- `<b-form-checkbox-group>` components render inline checkboxes by default, while `<b-form-checkbox>`
220
- renders block-level (stacked) checkboxes.
221
-
222
- Set the prop `stacked` on `<b-form-checkbox-group>` to place each form control one over the other,
223
- or if using individual checkboxes not inside a `<b-form-checkbox-group>`, set the `inline` prop on
224
- `<b-form-checkbox>`.
225
-
226
- ```html
227
- <template>
228
- <div>
229
- <b-form-group
230
- label="Form-checkbox-group inline checkboxes (default)"
231
- v-slot="{ ariaDescribedby }"
232
- >
233
- <b-form-checkbox-group
234
- v-model="selected"
235
- :options="options"
236
- :aria-describedby="ariaDescribedby"
237
- name="flavour-1a"
238
- ></b-form-checkbox-group>
239
- </b-form-group>
240
-
241
- <b-form-group
242
- label="Form-checkbox-group stacked checkboxes"
243
- v-slot="{ ariaDescribedby }"
244
- >
245
- <b-form-checkbox-group
246
- v-model="selected"
247
- :options="options"
248
- :aria-describedby="ariaDescribedby"
249
- name="flavour-2a"
250
- stacked
251
- ></b-form-checkbox-group>
252
- </b-form-group>
253
-
254
- <b-form-group
255
- label="Individual stacked checkboxes (default)"
256
- v-slot="{ ariaDescribedby }"
257
- >
258
- <b-form-checkbox
259
- v-for="option in options"
260
- v-model="selected"
261
- :key="option.value"
262
- :value="option.value"
263
- :aria-describedby="ariaDescribedby"
264
- name="flavour-3a"
265
- >
266
- {{ option.text }}
267
- </b-form-checkbox>
268
- </b-form-group>
269
-
270
- <b-form-group
271
- label="Individual inline checkboxes"
272
- v-slot="{ ariaDescribedby }"
273
- >
274
- <b-form-checkbox
275
- v-for="option in options"
276
- v-model="selected"
277
- :key="option.value"
278
- :value="option.value"
279
- :aria-describedby="ariaDescribedby"
280
- name="flavour-4a"
281
- inline
282
- >
283
- {{ option.text }}
284
- </b-form-checkbox>
285
- </b-form-group>
286
- </div>
287
- </template>
288
-
289
- <script>
290
- export default {
291
- data() {
292
- return {
293
- selected: [], // Must be an array reference!
294
- options: [
295
- { text: 'Orange', value: 'orange' },
296
- { text: 'Apple', value: 'apple' },
297
- { text: 'Pineapple', value: 'pineapple' },
298
- { text: 'Grape', value: 'grape' }
299
- ]
300
- }
301
- }
302
- }
303
- </script>
304
-
305
- <!-- b-form-checkbox-stacked.vue -->
306
- ```
307
-
308
- ## Control sizing
309
-
310
- Use the `size` prop to control the size of the checkbox. The default size is medium. Supported size
311
- values are `sm` (small) and `lg` (large).
312
-
313
- ```html
314
- <div>
315
- <b-form-checkbox size="sm">Small</b-form-checkbox>
316
- <b-form-checkbox>Default</b-form-checkbox>
317
- <b-form-checkbox size="lg">Large</b-form-checkbox>
318
- </div>
319
-
320
- <!-- form-checkbox-sizes.vue -->
321
- ```
322
-
323
- Sizes can be set on individual `<b-form-checkbox>` components, or inherited from the size setting of
324
- `<b-form-checkbox-group>`.
325
-
326
- **Note:** Bootstrap v4.x does not natively support sizes for the custom checkbox control. However,
327
- BootstrapVue includes custom SCSS/CSS that adds support for sizing the custom checkboxes.
328
-
329
- ## Checkbox values and `v-model`
330
-
331
- By default, `<b-form-checkbox>` value will be `true` when checked and `false` when unchecked. You
332
- can customize the checked and unchecked values by specifying the `value` and `unchecked-value`
333
- properties, respectively.
334
-
335
- The `v-model` binds to the `checked` prop. When you have multiple checkboxes that bind to a single
336
- data state variable, you **must** provide an array reference (`[]`) to your `v-model`. Do not use
337
- the `checked` prop directly.
338
-
339
- Note that when `v-model` is bound to multiple checkboxes (i.e an array ref), the `unchecked-value`
340
- is **not used**. Only the value(s) of the checked checkboxes will be returned in the `v-model` bound
341
- array. You should provide a unique value for each checkbox's `value` prop (the default of `true`
342
- will not work when bound to an array)
343
-
344
- To pre-check any radios, set the `v-model` to the value(s) of the checks that you would like
345
- pre-selected.
346
-
347
- When placing individual `<b-form-checkbox>` components within a `<b-form-checkbox-group>`, most
348
- props and the `v-model` are inherited from the `<b-form-checkbox-group>`.
349
-
350
- **Note:** the `unchecked-value` prop _does not_ affect the native `<input>`'s `value` attribute,
351
- because browsers don't include unchecked boxes in form submissions. To guarantee that one of two
352
- values is submitted in a native `<form>` submit (e.g. `'yes'` or `'no'`), use radio inputs instead.
353
- This is the same limitation that
354
- [Vue has with native checkbox inputs](https://vuejs.org/v2/guide/forms.html#Checkbox-1).
355
-
356
- ### Multiple checkboxes and accessibility
357
-
358
- When binding multiple checkboxes together, you must set the `name` prop to the same value for all
359
- `<b-form-checkbox>`s in the group individually or via the `name` prop of `<b-form-checkbox-group>`.
360
- This will inform users of assistive technologies that the checkboxes are related and enables native
361
- browser keyboard navigation.
362
-
363
- Whenever using multiple checkboxes, it is recommended that the checkboxes be placed in a
364
- [`<gl-form-group>`](?path=/docs/base-form-form-group--docs) component to associate a label with the
365
- entire group of checkboxes. See examples above.
366
-
367
- ## Switch style checkboxes
368
-
369
- Switch styling is supported on `<b-form-checkbox>` and `<b-form-checkbox-group>` components.
370
-
371
- ### Individual checkbox switch style
372
-
373
- A single checkbox can be rendered with a switch appearance by setting the prop `switch` to `true`
374
-
375
- ```html
376
- <template>
377
- <div>
378
- <b-form-checkbox v-model="checked" name="check-button" switch>
379
- Switch Checkbox <b>(Checked: {{ checked }})</b>
380
- </b-form-checkbox>
381
- </div>
382
- </template>
383
-
384
- <script>
385
- export default {
386
- data() {
387
- return {
388
- checked: false
389
- }
390
- }
391
- }
392
- </script>
393
-
394
- <!-- b-form-checkbox-switch.vue -->
395
- ```
396
-
397
- ### Grouped switch style checkboxes
398
-
399
- Render groups of checkboxes with the look of a switches by setting the prop `switches` on
400
- `<b-form-checkbox-group>`.
401
-
402
- ```html
403
- <template>
404
- <div>
405
- <b-form-group
406
- label="Inline switch style checkboxes"
407
- v-slot="{ ariaDescribedby }"
408
- >
409
- <b-form-checkbox-group
410
- v-model="selected"
411
- :options="options"
412
- :aria-describedby="ariaDescribedby"
413
- switches
414
- ></b-form-checkbox-group>
415
- </b-form-group>
416
-
417
- <b-form-group
418
- label="Stacked (vertical) switch style checkboxes"
419
- v-slot="{ ariaDescribedby }"
420
- >
421
- <b-form-checkbox-group
422
- v-model="selected"
423
- :options="options"
424
- :aria-describedby="ariaDescribedby"
425
- switches
426
- stacked
427
- ></b-form-checkbox-group>
428
- </b-form-group>
429
- </div>
430
- </template>
431
-
432
- <script>
433
- export default {
434
- data() {
435
- return {
436
- selected: [], // Must be an array reference!
437
- options: [
438
- { text: 'Red', value: 'red' },
439
- { text: 'Green', value: 'green' },
440
- { text: 'Yellow (disabled)', value: 'yellow', disabled: true },
441
- { text: 'Blue', value: 'blue' }
442
- ]
443
- }
444
- }
445
- }
446
- </script>
447
-
448
- <!-- b-form-checkboxes-switch-group.vue -->
449
- ```
450
-
451
- ### Switch sizing
452
-
453
- Use the `size` prop to control the size of the switch. The default size is medium. Supported size
454
- values are `sm` (small) and `lg` (large).
455
-
456
- ```html
457
- <div>
458
- <b-form-checkbox switch size="sm">Small</b-form-checkbox>
459
- <b-form-checkbox switch>Default</b-form-checkbox>
460
- <b-form-checkbox switch size="lg">Large</b-form-checkbox>
461
- </div>
462
-
463
- <!-- form-checkbox-switch-sizes.vue -->
464
- ```
465
-
466
- Sizes can be set on individual `<b-form-checkbox>` components, or inherited from the size setting of
467
- `<b-form-checkbox-group>`.
468
-
469
- **Note:** Bootstrap v4.x does not natively support sizes for the custom switch control. However,
470
- BootstrapVue includes custom SCSS/CSS that adds support for sizing the custom switches.
471
-
472
- ## Contextual states
473
-
474
- Bootstrap includes validation styles for `valid` and `invalid` states on most form controls.
475
-
476
- Generally speaking, you'll want to use a particular state for specific types of feedback:
477
-
478
- - `false` (denotes invalid state) is great for when there's a blocking or required field. A user
479
- must fill in this field properly to submit the form.
480
- - `true` (denotes valid state) is ideal for situations when you have per-field validation throughout
481
- a form and want to encourage a user through the rest of the fields.
482
- - `null` Displays no validation state (neither valid nor invalid)
483
-
484
- To apply one of the contextual state icons on `<b-form-checkbox>`, set the `state` prop to `false`
485
- (for invalid), `true` (for valid), or `null` (no validation state).
486
-
487
- ### Contextual state and validation example
488
-
489
- ```html
490
- <template>
491
- <div>
492
- <b-form-checkbox-group
493
- v-model="value"
494
- :options="options"
495
- :state="state"
496
- name="checkbox-validation"
497
- >
498
- <b-form-invalid-feedback :state="state">Please select two</b-form-invalid-feedback>
499
- <b-form-valid-feedback :state="state">Thank you</b-form-valid-feedback>
500
- </b-form-checkbox-group>
501
- </div>
502
- </template>
503
-
504
- <script>
505
- export default {
506
- data() {
507
- return {
508
- value: [],
509
- options: [
510
- { text: 'First Check', value: 'first' },
511
- { text: 'Second Check', value: 'second' },
512
- { text: 'Third Check', value: 'third' }
513
- ]
514
- }
515
- },
516
- computed: {
517
- state() {
518
- return this.value.length === 2
519
- }
520
- }
521
- }
522
- </script>
523
-
524
- <!-- form-checkbox-validation.vue -->
525
- ```
526
-
527
- ### Required constraint
528
-
529
- When using individual `<b-form-checkbox>` components (not in a `<b-form-checkbox-group>`), and you
530
- want the checkbox(es) to be `required` in your form, you **must** provide a `name` on each
531
- `<b-form-checkbox>` in order for the required constraint to work. All `<b-form-checkbox>` components
532
- tied to the same `v-model` **must** have the same `name`.
533
-
534
- The `name` is required in order for Assistive Technologies (such as screen readers, and keyboard
535
- only users) to know which checkboxes belong to the same form variable (the name also automatically
536
- enables native browser keyboard navigation), hence `required` will only work if `name` is set.
537
- `<b-form-checkbox-group>` will automatically generate a unique input name if one is not provided on
538
- the group.
539
-
540
- ## Autofocus
541
-
542
- When the `autofocus` prop is set on `<b-form-checkbox>`, the input will be auto-focused when it is
543
- inserted (i.e. **mounted**) into the document, or re-activated when inside a Vue `<keep-alive>`
544
- component. Note that this prop **does not** set the `autofocus` attribute on the input, nor can it
545
- tell when the input becomes visible.
546
-
547
- ## Indeterminate (tri-state) support
548
-
549
- Normally a checkbox input can only have two states: _checked_ or _unchecked_. They can have any
550
- value, but they either submit that value (_checked_) or don't (_unchecked_) with a form submission
551
- (although BootstrapVue allows a value for the _unchecked_ state on a single checkbox)
552
-
553
- _Visually_, there are actually three states a checkbox can be in: _checked_, _unchecked_, or
554
- **_indeterminate_**.
555
-
556
- The _indeterminate_ state is **visual only**. The checkbox is still either checked or unchecked as a
557
- value. That means the visual indeterminate state masks the real value of the checkbox, so that
558
- better make sense in your UI!
559
-
560
- `<b-form-checkbox>` supports setting this visual indeterminate state via the `indeterminate` prop
561
- (defaults to `false`). Clicking the checkbox will clear its indeterminate state. The `indeterminate`
562
- prop can be synced to the checkbox's state by v-binding the `indeterminate` prop with the `.sync`
563
- modifier.
564
-
565
- **Note:** indeterminate styling is not supported in switch mode, nor is it supported in
566
- `<b-form-checkbox-group>` (multiple checkboxes).
567
-
568
- **Single Indeterminate checkbox:**
569
-
570
- ```html
571
- <template>
572
- <div>
573
- <b-form-checkbox v-model="checked" :indeterminate.sync="indeterminate">
574
- Click me to see what happens
575
- </b-form-checkbox>
576
-
577
- <div class="mt-3">
578
- Checked: <strong>{{ checked }}</strong><br>
579
- Indeterminate: <strong>{{ indeterminate }}</strong>
580
- </div>
581
-
582
- <b-button @click="toggleIndeterminate">Toggle Indeterminate State</b-button>
583
- </div>
584
- </template>
585
-
586
- <script>
587
- export default {
588
- data() {
589
- return {
590
- checked: true,
591
- indeterminate: true
592
- }
593
- },
594
- methods: {
595
- toggleIndeterminate() {
596
- this.indeterminate = !this.indeterminate
597
- }
598
- }
599
- }
600
- </script>
601
-
602
- <!-- b-form-checkbox-indeterminate.vue -->
603
- ```
604
-
605
- **Indeterminate checkbox use-case example:**
606
-
607
- ```html
608
- <template>
609
- <div>
610
- <b-form-group>
611
- <template #label>
612
- <b>Choose your flavours:</b><br>
613
- <b-form-checkbox
614
- v-model="allSelected"
615
- :indeterminate="indeterminate"
616
- aria-describedby="flavours"
617
- aria-controls="flavours"
618
- @change="toggleAll"
619
- >
620
- {{ allSelected ? 'Un-select All' : 'Select All' }}
621
- </b-form-checkbox>
622
- </template>
623
-
624
- <template v-slot="{ ariaDescribedby }">
625
- <b-form-checkbox-group
626
- id="flavors"
627
- v-model="selected"
628
- :options="flavours"
629
- :aria-describedby="ariaDescribedby"
630
- name="flavors"
631
- class="ml-4"
632
- aria-label="Individual flavours"
633
- stacked
634
- ></b-form-checkbox-group>
635
- </template>
636
- </b-form-group>
637
-
638
- <div>
639
- Selected: <strong>{{ selected }}</strong><br>
640
- All Selected: <strong>{{ allSelected }}</strong><br>
641
- Indeterminate: <strong>{{ indeterminate }}</strong>
642
- </div>
643
- </div>
644
- </template>
645
-
646
- <script>
647
- export default {
648
- data() {
649
- return {
650
- flavours: ['Orange', 'Grape', 'Apple', 'Lime', 'Very Berry'],
651
- selected: [],
652
- allSelected: false,
653
- indeterminate: false
654
- }
655
- },
656
- methods: {
657
- toggleAll(checked) {
658
- this.selected = checked ? this.flavours.slice() : []
659
- }
660
- },
661
- watch: {
662
- selected(newValue, oldValue) {
663
- // Handle changes in individual flavour checkboxes
664
- if (newValue.length === 0) {
665
- this.indeterminate = false
666
- this.allSelected = false
667
- } else if (newValue.length === this.flavours.length) {
668
- this.indeterminate = false
669
- this.allSelected = true
670
- } else {
671
- this.indeterminate = true
672
- this.allSelected = false
673
- }
674
- }
675
- }
676
- }
677
- </script>
678
-
679
- <!-- b-form-checkbox-indeterminate-multiple.vue -->
680
- ```
681
-
682
- **Note:** Pay attention that plain checkbox (i.e. with prop `plain`) also supports indeterminate
683
- state on Windows/Linux/Mac/Android, but not on iOS.
684
-
685
- ### Indeterminate state and accessibility
686
-
687
- Not all screen readers will convey the indeterminate state to screen reader users. So it is
688
- recommended to provide some form of textual feedback to the user (possibly by via the `.sr-only`
689
- class) if the indeterminate state has special contextual meaning in your application.
690
-
691
- <!-- Component reference added automatically from component package.json -->