@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.
- package/dist/components/base/breadcrumb/breadcrumb.js +4 -16
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +7 -26
- package/src/components/base/breadcrumb/breadcrumb.scss +18 -2
- package/src/components/base/breadcrumb/breadcrumb.vue +4 -17
- package/CHANGELOG.md +0 -13139
- package/src/vendor/bootstrap/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/LICENSE +0 -11
- package/src/vendor/bootstrap-vue/package.json +0 -144
- package/src/vendor/bootstrap-vue/src/components/button/MODIFICATIONS.md +0 -16
- package/src/vendor/bootstrap-vue/src/components/button/README.md +0 -240
- package/src/vendor/bootstrap-vue/src/components/button/button-close.spec.js +0 -210
- package/src/vendor/bootstrap-vue/src/components/button/button.spec.js +0 -349
- package/src/vendor/bootstrap-vue/src/components/button/package.json +0 -105
- package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +0 -730
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.spec.js +0 -58
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.spec.js +0 -110
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.spec.js +0 -73
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.spec.js +0 -147
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.spec.js +0 -59
- package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.spec.js +0 -1121
- package/src/vendor/bootstrap-vue/src/components/dropdown/package.json +0 -368
- package/src/vendor/bootstrap-vue/src/components/form/README.md +0 -365
- package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.spec.js +0 -170
- package/src/vendor/bootstrap-vue/src/components/form/form-text.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.spec.js +0 -157
- package/src/vendor/bootstrap-vue/src/components/form/form.spec.js +0 -97
- package/src/vendor/bootstrap-vue/src/components/form/package.json +0 -112
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/README.md +0 -691
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox-group.spec.js +0 -525
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/form-checkbox.spec.js +0 -922
- package/src/vendor/bootstrap-vue/src/components/form-checkbox/package.json +0 -172
- package/src/vendor/bootstrap-vue/src/components/form-group/README.md +0 -339
- package/src/vendor/bootstrap-vue/src/components/form-group/form-group.spec.js +0 -477
- package/src/vendor/bootstrap-vue/src/components/form-group/package.json +0 -183
- package/src/vendor/bootstrap-vue/src/components/form-radio/README.md +0 -437
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.spec.js +0 -357
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.spec.js +0 -587
- package/src/vendor/bootstrap-vue/src/components/form-radio/package.json +0 -162
- package/src/vendor/bootstrap-vue/src/components/form-select/README.md +0 -504
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.spec.js +0 -138
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.spec.js +0 -75
- package/src/vendor/bootstrap-vue/src/components/form-select/form-select.spec.js +0 -723
- package/src/vendor/bootstrap-vue/src/components/form-select/package.json +0 -132
- package/src/vendor/bootstrap-vue/src/components/form-textarea/README.md +0 -453
- package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.spec.js +0 -1000
- package/src/vendor/bootstrap-vue/src/components/form-textarea/package.json +0 -122
- package/src/vendor/bootstrap-vue/src/components/layout/README.md +0 -791
- package/src/vendor/bootstrap-vue/src/components/layout/col.spec.js +0 -192
- package/src/vendor/bootstrap-vue/src/components/layout/form-row.spec.js +0 -45
- package/src/vendor/bootstrap-vue/src/components/layout/package.json +0 -99
- package/src/vendor/bootstrap-vue/src/components/link/README.md +0 -76
- package/src/vendor/bootstrap-vue/src/components/link/link.spec.js +0 -434
- package/src/vendor/bootstrap-vue/src/components/link/package.json +0 -57
- package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +0 -30
- package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -1067
- package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/components/modal/modal.spec.js +0 -1418
- package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -544
- package/src/vendor/bootstrap-vue/src/components/nav/README.md +0 -362
- package/src/vendor/bootstrap-vue/src/components/nav/nav-item.spec.js +0 -127
- package/src/vendor/bootstrap-vue/src/components/nav/nav.spec.js +0 -177
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -73
- package/src/vendor/bootstrap-vue/src/components/popover/README.md +0 -919
- package/src/vendor/bootstrap-vue/src/components/popover/package.json +0 -261
- package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -198
- package/src/vendor/bootstrap-vue/src/components/table/README.md +0 -3157
- package/src/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.spec.js +0 -93
- package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -1763
- package/src/vendor/bootstrap-vue/src/components/table/table-busy.spec.js +0 -150
- package/src/vendor/bootstrap-vue/src/components/table/table-caption.spec.js +0 -176
- package/src/vendor/bootstrap-vue/src/components/table/table-colgroup.spec.js +0 -81
- package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +0 -409
- package/src/vendor/bootstrap-vue/src/components/table/table-item-formatter.spec.js +0 -56
- package/src/vendor/bootstrap-vue/src/components/table/table-lite.spec.js +0 -682
- package/src/vendor/bootstrap-vue/src/components/table/table-pagination.spec.js +0 -133
- package/src/vendor/bootstrap-vue/src/components/table/table-primarykey.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-provider.spec.js +0 -411
- package/src/vendor/bootstrap-vue/src/components/table/table-row-details.spec.js +0 -459
- package/src/vendor/bootstrap-vue/src/components/table/table-selectable.spec.js +0 -1182
- package/src/vendor/bootstrap-vue/src/components/table/table-simple.spec.js +0 -206
- package/src/vendor/bootstrap-vue/src/components/table/table-sorting.spec.js +0 -858
- package/src/vendor/bootstrap-vue/src/components/table/table-sticky-column.spec.js +0 -377
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-bottom-row.spec.js +0 -94
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-row-events.spec.js +0 -529
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-top-row.spec.js +0 -88
- package/src/vendor/bootstrap-vue/src/components/table/table-tbody-transition.spec.js +0 -83
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-custom.spec.js +0 -91
- package/src/vendor/bootstrap-vue/src/components/table/table-tfoot-events.spec.js +0 -137
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-events.spec.js +0 -155
- package/src/vendor/bootstrap-vue/src/components/table/table-thead-top.spec.js +0 -96
- package/src/vendor/bootstrap-vue/src/components/table/table.spec.js +0 -692
- package/src/vendor/bootstrap-vue/src/components/tabs/README.md +0 -433
- package/src/vendor/bootstrap-vue/src/components/tabs/package.json +0 -205
- package/src/vendor/bootstrap-vue/src/components/tabs/tab.spec.js +0 -330
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.spec.js +0 -778
- package/src/vendor/bootstrap-vue/src/components/toast/README.md +0 -655
- package/src/vendor/bootstrap-vue/src/components/toast/helpers/bv-toast.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/components/toast/package.json +0 -184
- package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +0 -294
- package/src/vendor/bootstrap-vue/src/components/toast/toaster.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/components/tooltip/README.md +0 -559
- package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -258
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +0 -1240
- package/src/vendor/bootstrap-vue/src/components/transition/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/package.json +0 -5
- package/src/vendor/bootstrap-vue/src/components/transporter/transporter.spec.js +0 -85
- package/src/vendor/bootstrap-vue/src/directives/modal/modal.spec.js +0 -191
- package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -521
- package/src/vendor/bootstrap-vue/src/directives/tooltip/package.json +0 -131
- package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +0 -190
- package/src/vendor/bootstrap-vue/src/directives/visible/README.md +0 -244
- package/src/vendor/bootstrap-vue/src/directives/visible/package.json +0 -24
- package/src/vendor/bootstrap-vue/src/mixins/attrs.spec.js +0 -194
- package/src/vendor/bootstrap-vue/src/mixins/click-out.spec.js +0 -52
- package/src/vendor/bootstrap-vue/src/mixins/focus-in.spec.js +0 -53
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.spec.js +0 -117
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.spec.js +0 -77
- package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.spec.js +0 -115
- package/src/vendor/bootstrap-vue/src/mixins/listeners.spec.js +0 -245
- package/src/vendor/bootstrap-vue/src/utils/bv-event.class.spec.js +0 -66
- package/src/vendor/bootstrap-vue/src/utils/clone-deep.spec.js +0 -70
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +0 -169
- package/src/vendor/bootstrap-vue/src/utils/css-escape.spec.js +0 -82
- package/src/vendor/bootstrap-vue/src/utils/dom.spec.js +0 -291
- package/src/vendor/bootstrap-vue/src/utils/events.spec.js +0 -41
- package/src/vendor/bootstrap-vue/src/utils/get.spec.js +0 -109
- package/src/vendor/bootstrap-vue/src/utils/inspect.spec.js +0 -251
- package/src/vendor/bootstrap-vue/src/utils/loose-equal.spec.js +0 -203
- package/src/vendor/bootstrap-vue/src/utils/normalize-slot.spec.js +0 -63
- package/src/vendor/bootstrap-vue/src/utils/number.spec.js +0 -72
- package/src/vendor/bootstrap-vue/src/utils/object.spec.js +0 -61
- package/src/vendor/bootstrap-vue/src/utils/props.spec.js +0 -112
- package/src/vendor/bootstrap-vue/src/utils/router.spec.js +0 -248
- package/src/vendor/bootstrap-vue/src/utils/string.spec.js +0 -65
- package/src/vendor/bootstrap-vue/src/utils/stringify-object-values.spec.js +0 -47
- package/src/vendor/bootstrap-vue/src/utils/warn.spec.js +0 -54
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
# Tabs
|
|
2
|
-
|
|
3
|
-
> Create a widget of tabbable panes of _local content_. The tabs component is built upon navs
|
|
4
|
-
> internally, and provides full keyboard navigation control of the tabs.
|
|
5
|
-
|
|
6
|
-
For navigation based tabs (i.e. tabs that would change the URL), use the
|
|
7
|
-
[nav](?path=/docs/base-nav--docs) component instead.
|
|
8
|
-
|
|
9
|
-
## Basic usage
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<div>
|
|
13
|
-
<b-tabs content-class="mt-3">
|
|
14
|
-
<b-tab title="First" active><p>I'm the first tab</p></b-tab>
|
|
15
|
-
<b-tab title="Second"><p>I'm the second tab</p></b-tab>
|
|
16
|
-
<b-tab title="Disabled" disabled><p>I'm a disabled tab!</p></b-tab>
|
|
17
|
-
</b-tabs>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<!-- b-tabs.vue -->
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Tip:** You should supply each child `<b-tab>` component a unique `key` value if dynamically adding
|
|
24
|
-
or removing `<b-tab>` components (i.e. `v-if` or for loops). The `key` attribute is a special Vue
|
|
25
|
-
attribute, see https://vuejs.org/v2/api/#key.
|
|
26
|
-
|
|
27
|
-
## Pills variant
|
|
28
|
-
|
|
29
|
-
Tabs use the `tabs` styling by default. Just add `pills` property to `<b-tabs>` for the pill style
|
|
30
|
-
variant.
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<div>
|
|
34
|
-
<b-tabs pills>
|
|
35
|
-
<b-tab title="Tab 1" active>Tab contents 1</b-tab>
|
|
36
|
-
<b-tab title="Tab 2">Tab contents 2></b-tab>
|
|
37
|
-
</b-tabs>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<!-- b-tabs-pills.vue -->
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Fill and justify
|
|
44
|
-
|
|
45
|
-
Force your `<b-tabs>` controls to extend the full available width.
|
|
46
|
-
|
|
47
|
-
### Fill
|
|
48
|
-
|
|
49
|
-
To proportionately fill all available space with your tab controls, set the `fill` prop. Notice that
|
|
50
|
-
all horizontal space is occupied, but not every control has the same width.
|
|
51
|
-
|
|
52
|
-
```html
|
|
53
|
-
<div>
|
|
54
|
-
<b-tabs content-class="mt-3" fill>
|
|
55
|
-
<b-tab title="First" active><p>I'm the first tab</p></b-tab>
|
|
56
|
-
<b-tab title="Second"><p>I'm the second tab</p></b-tab>
|
|
57
|
-
<b-tab title="Very, very long title"><p>I'm the tab with the very, very long title</p></b-tab>
|
|
58
|
-
<b-tab title="Disabled" disabled><p>I'm a disabled tab!</p></b-tab>
|
|
59
|
-
</b-tabs>
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<!-- b-tabs-fill.vue -->
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Justified
|
|
66
|
-
|
|
67
|
-
For equal-width controls, use the `justified` prop instead. All horizontal space will be occupied by
|
|
68
|
-
the controls, but unlike using `fill` above, every control will be the same width.
|
|
69
|
-
|
|
70
|
-
```html
|
|
71
|
-
<div>
|
|
72
|
-
<b-tabs content-class="mt-3" justified>
|
|
73
|
-
<b-tab title="First" active><p>I'm the first tab</p></b-tab>
|
|
74
|
-
<b-tab title="Second"><p>I'm the second tab</p></b-tab>
|
|
75
|
-
<b-tab title="Very, very long title"><p>I'm the tab with the very, very long title</p></b-tab>
|
|
76
|
-
<b-tab title="Disabled" disabled><p>I'm a disabled tab!</p></b-tab>
|
|
77
|
-
</b-tabs>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<!-- b-tabs-justified.vue -->
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Alignment
|
|
84
|
-
|
|
85
|
-
To align your tab controls, use the `align` prop. Available values are `left`, `center` and `right`.
|
|
86
|
-
|
|
87
|
-
```html
|
|
88
|
-
<div>
|
|
89
|
-
<b-tabs content-class="mt-3" align="center">
|
|
90
|
-
<b-tab title="First" active><p>I'm the first tab</p></b-tab>
|
|
91
|
-
<b-tab title="Second"><p>I'm the second tab</p></b-tab>
|
|
92
|
-
<b-tab title="Disabled" disabled><p>I'm a disabled tab!</p></b-tab>
|
|
93
|
-
</b-tabs>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<!-- b-tabs-alignment.vue -->
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Bottom placement of tab controls
|
|
100
|
-
|
|
101
|
-
Visually move the tab controls to the bottom by setting the prop `end`.
|
|
102
|
-
|
|
103
|
-
```html
|
|
104
|
-
<div>
|
|
105
|
-
<b-tabs pills end>
|
|
106
|
-
<b-tab title="Tab 1" active>Tab contents 1</b-tab>
|
|
107
|
-
<b-tab title="Tab 2">Tab contents 2</b-tab>
|
|
108
|
-
</b-tabs>
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<!-- b-tabs-bottom.vue -->
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Caveats:**
|
|
115
|
-
|
|
116
|
-
- Bottom placement visually works best with the `pills` variant. When using the default `tabs`
|
|
117
|
-
variant, you may want to provided your own custom styling classes, as Bootstrap v4 CSS assumes the
|
|
118
|
-
tabs will always be placed on the top of the tabs content.
|
|
119
|
-
- To provide a better user experience with bottom placed controls, ensure that the content of each
|
|
120
|
-
tab pane is the same height and fits completely within the visible viewport, otherwise the user
|
|
121
|
-
will need to scroll up to read the start of the tabbed content.
|
|
122
|
-
|
|
123
|
-
## Active classes
|
|
124
|
-
|
|
125
|
-
To apply classes to the currently active control or tab use the `active-nav-item-class` and
|
|
126
|
-
`active-tab-class` props.
|
|
127
|
-
|
|
128
|
-
```html
|
|
129
|
-
<div>
|
|
130
|
-
<b-tabs
|
|
131
|
-
active-nav-item-class="font-weight-bold text-uppercase text-danger"
|
|
132
|
-
active-tab-class="font-weight-bold text-success"
|
|
133
|
-
content-class="mt-3"
|
|
134
|
-
>
|
|
135
|
-
<b-tab title="First" active><p>I'm the first tab</p></b-tab>
|
|
136
|
-
<b-tab title="Second"><p>I'm the second tab</p></b-tab>
|
|
137
|
-
<b-tab title="Disabled" disabled><p>I'm a disabled tab!</p></b-tab>
|
|
138
|
-
</b-tabs>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<!-- b-tabs-classes.vue -->
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Fade animation
|
|
145
|
-
|
|
146
|
-
Fade is enabled by default when changing tabs. It can disabled with `no-fade` property.
|
|
147
|
-
|
|
148
|
-
## Add tabs without content
|
|
149
|
-
|
|
150
|
-
If you want to add extra tabs that do not have any content, you can put them in `tabs-start` or
|
|
151
|
-
`tabs-end` slot(s):
|
|
152
|
-
|
|
153
|
-
```html
|
|
154
|
-
<div>
|
|
155
|
-
<b-tabs>
|
|
156
|
-
<!-- Add your b-tab components here -->
|
|
157
|
-
<template #tabs-end>
|
|
158
|
-
<b-nav-item href="#" role="presentation" @click="() => {}">Another tab</b-nav-item>
|
|
159
|
-
<li role="presentation" class="nav-item align-self-center">Plain text</li>
|
|
160
|
-
</template>
|
|
161
|
-
</b-tabs>
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
<!-- b-tabs-item-slot.vue -->
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Use the `tabs-start` slot to place extra tab buttons before the content tab buttons, and use the
|
|
168
|
-
`tabs-end` slot to place extra tab buttons after the content tab buttons.
|
|
169
|
-
|
|
170
|
-
**Note:** extra (contentless) tab buttons should be a `<b-nav-item>` or have a root element of
|
|
171
|
-
`<li>` and class `nav-item` for proper rendering and semantic markup.
|
|
172
|
-
|
|
173
|
-
## Add custom content to tab title
|
|
174
|
-
|
|
175
|
-
If you want to add custom content to tab title, like HTML code, icons, or another non-interactive
|
|
176
|
-
Vue component, this possible by using `title` slot of `<b-tab>`.
|
|
177
|
-
|
|
178
|
-
```html
|
|
179
|
-
<div>
|
|
180
|
-
<b-tabs>
|
|
181
|
-
<b-tab active>
|
|
182
|
-
<template #title>
|
|
183
|
-
I'm <i>custom</i> <strong>title</strong>
|
|
184
|
-
</template>
|
|
185
|
-
<p class="p-3">Tab contents 1</p>
|
|
186
|
-
</b-tab>
|
|
187
|
-
|
|
188
|
-
<b-tab>
|
|
189
|
-
<template #title>
|
|
190
|
-
Tab 2
|
|
191
|
-
</template>
|
|
192
|
-
<p class="p-3">Tab contents 2</p>
|
|
193
|
-
</b-tab>
|
|
194
|
-
</b-tabs>
|
|
195
|
-
</div>
|
|
196
|
-
|
|
197
|
-
<!-- b-tabs-title-slot.vue -->
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**Do not** place interactive elements/components inside the title slot. The tab button is a link
|
|
201
|
-
which does not support child interactive elements per the HTML5 spec.
|
|
202
|
-
|
|
203
|
-
## Apply custom classes to the generated nav-tabs or pills
|
|
204
|
-
|
|
205
|
-
The tab selectors are based on Bootstrap v4's `nav` markup ( i.e.
|
|
206
|
-
`ul.nav > li.nav-item > a.nav-link`). In some situations, you may want to add classes to the `<li>`
|
|
207
|
-
(nav-item) and/or the `<a>` (nav-link) on a per tab basis. To do so, simply supply the classname to
|
|
208
|
-
the `title-item-class` prop (for the `<li>` element) or `title-link-class` prop (for the `<a>`
|
|
209
|
-
element). Value's can be passed as a string or array of strings.
|
|
210
|
-
|
|
211
|
-
**Note:** _The `active` class is automatically applied to the active tabs `<a>` element. You may
|
|
212
|
-
need to accommodate your custom classes for this._
|
|
213
|
-
|
|
214
|
-
```html
|
|
215
|
-
<template>
|
|
216
|
-
<div>
|
|
217
|
-
<b-tabs v-model="tabIndex">
|
|
218
|
-
<b-tab title="Tab 1" :title-link-class="linkClass(0)">Tab contents 1</b-tab>
|
|
219
|
-
<b-tab title="Tab 2" :title-link-class="linkClass(1)">Tab contents 2</b-tab>
|
|
220
|
-
<b-tab title="Tab 3" :title-link-class="linkClass(2)">Tab contents 3</b-tab>
|
|
221
|
-
</b-tabs>
|
|
222
|
-
</div>
|
|
223
|
-
</template>
|
|
224
|
-
|
|
225
|
-
<script>
|
|
226
|
-
export default {
|
|
227
|
-
data() {
|
|
228
|
-
return {
|
|
229
|
-
tabIndex: 0
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
methods: {
|
|
233
|
-
linkClass(idx) {
|
|
234
|
-
if (this.tabIndex === idx) {
|
|
235
|
-
return ['bg-primary', 'text-light']
|
|
236
|
-
} else {
|
|
237
|
-
return ['bg-light', 'text-info']
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
</script>
|
|
243
|
-
|
|
244
|
-
<!-- b-tabs-with-classes.vue -->
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Lazy loading tab content
|
|
248
|
-
|
|
249
|
-
Sometimes it's preferred to load components & data only when activating a tab, instead of loading
|
|
250
|
-
all tabs (and associated data) when rendering the `<b-tabs>` set.
|
|
251
|
-
|
|
252
|
-
Individual `<b-tab>` components can be lazy loaded via the `lazy` prop, which when set doesn't mount
|
|
253
|
-
the content of the `<b-tab>` until it is activated (shown), and will be un-mounted when the tab is
|
|
254
|
-
deactivated (hidden):
|
|
255
|
-
|
|
256
|
-
```html
|
|
257
|
-
<b-tabs content-class="mt-3">
|
|
258
|
-
<!-- This tabs content will always be mounted -->
|
|
259
|
-
<b-tab title="Regular tab"><b-alert show>I'm always mounted</b-alert></b-tab>
|
|
260
|
-
|
|
261
|
-
<!-- This tabs content will not be mounted until the tab is shown -->
|
|
262
|
-
<!-- and will be un-mounted when hidden -->
|
|
263
|
-
<b-tab title="Lazy tab" lazy><b-alert show>I'm lazy mounted!</b-alert></b-tab>
|
|
264
|
-
</b-tabs>
|
|
265
|
-
|
|
266
|
-
<!-- b-tabs-lazy-tab.vue -->
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
One can also make all tab's lazy by setting the `lazy` prop on the parent `<b-tabs>` component:
|
|
270
|
-
|
|
271
|
-
```html
|
|
272
|
-
<b-tabs content-class="mt-3" lazy>
|
|
273
|
-
<b-tab title="Tab 1"><b-alert show>I'm lazy mounted!</b-alert></b-tab>
|
|
274
|
-
<b-tab title="Tab 2"><b-alert show>I'm lazy mounted too!</b-alert></b-tab>
|
|
275
|
-
</b-tabs>
|
|
276
|
-
|
|
277
|
-
<!-- b-tabs-lazy.vue -->
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
## Keyboard navigation
|
|
281
|
-
|
|
282
|
-
Keyboard navigation is enabled by default for ARIA compliance with tablists when a tab button has
|
|
283
|
-
focus.
|
|
284
|
-
|
|
285
|
-
| Keypress | Action |
|
|
286
|
-
| --------------------------------------------------------------------- | ---------------------------------------------- |
|
|
287
|
-
| <kbd>Left</kbd> or <kbd>Up</kbd> | Activate the previous non-disabled tab |
|
|
288
|
-
| <kbd>Right</kbd> or <kbd>Down</kbd> | Activate the next non-disabled tab |
|
|
289
|
-
| <kbd>Shift</kbd>+<kbd>Left</kbd> or <kbd>Shift</kbd>+<kbd>Up</kbd> | Activate the first non-disabled tab |
|
|
290
|
-
| <kbd>Home</kbd> | Activate the first non-disabled tab |
|
|
291
|
-
| <kbd>Shift</kbd>+<kbd>Right</kbd> or <kbd>Shift</kbd>+<kbd>Down</kbd> | Activate the last non-disabled tab |
|
|
292
|
-
| <kbd>End</kbd> | Activate the last non-disabled tab |
|
|
293
|
-
| <kbd>Tab</kbd> | Move focus to the active tab content |
|
|
294
|
-
| <kbd>Shift</kbd>+<kbd>Tab</kbd> | Move focus to the previous control on the page |
|
|
295
|
-
|
|
296
|
-
Disable keyboard navigation by setting the prop `no-key-nav`. Behavior will now default to regular
|
|
297
|
-
browser navigation with TAB key.
|
|
298
|
-
|
|
299
|
-
| Keypress | Action |
|
|
300
|
-
| ------------------------------------ | ------------------------------------------------------ |
|
|
301
|
-
| <kbd>Tab</kbd> | Move to the next tab button or control on the page |
|
|
302
|
-
| <kbd>Shift</kbd>+<kbd>Tab</kbd> | Move to the previous tab button or control on the page |
|
|
303
|
-
| <kbd>Enter</kbd> or <kbd>Space</kbd> | Activate current focused button's tab |
|
|
304
|
-
|
|
305
|
-
## Programmatically activating and deactivating tabs
|
|
306
|
-
|
|
307
|
-
Use the `<b-tabs>` `v-model` to control which tab is active by setting the `v-model` to the index
|
|
308
|
-
(zero-based) of the tab to be shown (see example below).
|
|
309
|
-
|
|
310
|
-
Alternatively, you can use the `active` prop on each `<b-tab>` with the `.sync` modifier to activate
|
|
311
|
-
the tab, or to detect if a particular tab is active.
|
|
312
|
-
|
|
313
|
-
Each `<b-tab>` instance also provides two public methods to activate or deactivate the tab. The
|
|
314
|
-
methods are `.activate()` and `.deactivate()`, respectively. If activation or deactivation fails
|
|
315
|
-
(i.e. a tab is disabled or no tab is available to move activation to), then the currently active tab
|
|
316
|
-
will remain active and the method will return `false`. You will need a reference to the `<b-tab>` in
|
|
317
|
-
order to use these methods.
|
|
318
|
-
|
|
319
|
-
## Preventing a `<b-tab>` from being activated
|
|
320
|
-
|
|
321
|
-
To prevent a tab from activating, simply set the `disabled` prop on the `<b-tab>` component.
|
|
322
|
-
|
|
323
|
-
Alternatively, you can listen for the `activate-tab` event, which provides an option to prevent the
|
|
324
|
-
tab from activating. The `activate-tab` event is emitted with three arguments:
|
|
325
|
-
|
|
326
|
-
- `newTabIndex`: The index of the tab that is going to be activated
|
|
327
|
-
- `prevTabIndex`: The index of the currently active tab
|
|
328
|
-
- `bvEvent`: The `BvEvent` object. Call `bvEvent.preventDefault()` to prevent `newTabIndex` from
|
|
329
|
-
being activated
|
|
330
|
-
|
|
331
|
-
For accessibility reasons, when using the `activate-tab` event to prevent a tab from activating, you
|
|
332
|
-
should provide some means of notification to the user as to why the tab is not able to be activated.
|
|
333
|
-
It is recommended to use the `disabled` attribute on the `<b-tab>` component instead of using the
|
|
334
|
-
`activate-tab` event (as `disabled` is more intuitive for screen reader users).
|
|
335
|
-
|
|
336
|
-
## Advanced examples
|
|
337
|
-
|
|
338
|
-
### External controls using `v-model`
|
|
339
|
-
|
|
340
|
-
```html
|
|
341
|
-
<template>
|
|
342
|
-
<div>
|
|
343
|
-
<b-tabs v-model="tabIndex" small>
|
|
344
|
-
<b-tab title="General">I'm the first fading tab</b-tab>
|
|
345
|
-
<b-tab title="Edit profile">
|
|
346
|
-
I'm the second tab
|
|
347
|
-
</b-tab>
|
|
348
|
-
<b-tab title="Premium Plan" disabled>Sibzamini!</b-tab>
|
|
349
|
-
<b-tab title="Info">I'm the last tab</b-tab>
|
|
350
|
-
</b-tabs>
|
|
351
|
-
|
|
352
|
-
<!-- Control buttons-->
|
|
353
|
-
<div class="text-center">
|
|
354
|
-
<b-button-group class="mt-2">
|
|
355
|
-
<b-button @click="tabIndex--">Previous</b-button>
|
|
356
|
-
<b-button @click="tabIndex++">Next</b-button>
|
|
357
|
-
</b-button-group>
|
|
358
|
-
|
|
359
|
-
<div class="text-muted">Current Tab: {{ tabIndex }}</div>
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</template>
|
|
363
|
-
|
|
364
|
-
<script>
|
|
365
|
-
export default {
|
|
366
|
-
data() {
|
|
367
|
-
return {
|
|
368
|
-
tabIndex: 1
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
</script>
|
|
373
|
-
|
|
374
|
-
<!-- b-tabs-controls.vue -->
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Dynamic tabs + tabs-end slot
|
|
378
|
-
|
|
379
|
-
```html
|
|
380
|
-
<template>
|
|
381
|
-
<div>
|
|
382
|
-
<b-tabs>
|
|
383
|
-
<!-- Render Tabs, supply a unique `key` to each tab -->
|
|
384
|
-
<b-tab v-for="i in tabs" :key="'dyn-tab-' + i" :title="'Tab ' + i">
|
|
385
|
-
Tab contents {{ i }}
|
|
386
|
-
<b-button size="sm" variant="danger" class="float-right" @click="closeTab(i)">
|
|
387
|
-
Close tab
|
|
388
|
-
</b-button>
|
|
389
|
-
</b-tab>
|
|
390
|
-
|
|
391
|
-
<!-- New Tab Button (Using tabs-end slot) -->
|
|
392
|
-
<template #tabs-end>
|
|
393
|
-
<b-nav-item role="presentation" @click.prevent="newTab" href="#"><b>+</b></b-nav-item>
|
|
394
|
-
</template>
|
|
395
|
-
|
|
396
|
-
<!-- Render this if no tabs -->
|
|
397
|
-
<template #empty>
|
|
398
|
-
<div class="text-center text-muted">
|
|
399
|
-
There are no open tabs<br>
|
|
400
|
-
Open a new tab using the <b>+</b> button above.
|
|
401
|
-
</div>
|
|
402
|
-
</template>
|
|
403
|
-
</b-tabs>
|
|
404
|
-
</div>
|
|
405
|
-
</template>
|
|
406
|
-
|
|
407
|
-
<script>
|
|
408
|
-
export default {
|
|
409
|
-
data() {
|
|
410
|
-
return {
|
|
411
|
-
tabs: [],
|
|
412
|
-
tabCounter: 0
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
methods: {
|
|
416
|
-
closeTab(x) {
|
|
417
|
-
for (let i = 0; i < this.tabs.length; i++) {
|
|
418
|
-
if (this.tabs[i] === x) {
|
|
419
|
-
this.tabs.splice(i, 1)
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
newTab() {
|
|
424
|
-
this.tabs.push(this.tabCounter++)
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
</script>
|
|
429
|
-
|
|
430
|
-
<!-- b-tabs-dynamic.vue -->
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
<!-- Component reference added automatically from component package.json -->
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bootstrap-vue/tabs",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"meta": {
|
|
5
|
-
"title": "Tabs",
|
|
6
|
-
"description": "Create a widget of tabbable panes of local content. The tabs component is built upon navs and cards internally, and provides full keyboard navigation control of the tabs.",
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"component": "BTabs",
|
|
10
|
-
"props": [
|
|
11
|
-
{
|
|
12
|
-
"prop": "activeNavItemClass",
|
|
13
|
-
"description": "CSS class (or classes) to apply to the active nav item tab control"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"prop": "activeTabClass",
|
|
17
|
-
"description": "CSS class (or classes) to apply to the currently active tab"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"prop": "align",
|
|
21
|
-
"description": "Align the nav items in the nav: 'start' (or 'left'), 'center', 'end' (or 'right')"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"prop": "card",
|
|
25
|
-
"description": "When set to true, renders the tabs the the appropriate styles to be placed into a 'b-card'"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"prop": "contentClass",
|
|
29
|
-
"description": "CSS class (or classes) to apply to the tab-content wrapper"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"prop": "end",
|
|
33
|
-
"description": "Place the tab controls at the bottom (horizontal tabs), or right (vertical tabs)"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"prop": "fill",
|
|
37
|
-
"description": "Proportionately fills all horizontal space with nav items. All horizontal space is occupied, but not every nav item has the same width"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"prop": "justified",
|
|
41
|
-
"description": "Fills all horizontal space with nav items, but unlike 'fill', every nav item will be the same width"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"prop": "lazy",
|
|
45
|
-
"description": "Lazily render the b-tab contents when shown"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"prop": "navClass",
|
|
49
|
-
"description": "CSS class (or classes) to apply to the tablist (nav) wrapper"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"prop": "navWrapperClass",
|
|
53
|
-
"description": "CSS class (or classes) to apply to the tab controls wrapper element"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"prop": "noKeyNav",
|
|
57
|
-
"description": "Disable keyboard navigation of the tab controls"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"prop": "noNavStyle",
|
|
61
|
-
"description": "Do not render the tab controls with tab styling"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"prop": "pills",
|
|
65
|
-
"description": "Renders the nav items with the appearance of pill buttons"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"prop": "small",
|
|
69
|
-
"description": "Makes the nav smaller"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"prop": "value",
|
|
73
|
-
"description": "Currently visible tab index (zero-based)"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"prop": "vertical",
|
|
77
|
-
"description": "Renders the nav vertically"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"prop": "vertical",
|
|
81
|
-
"description": "Renders the tab controls vertically"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"events": [
|
|
85
|
-
{
|
|
86
|
-
"event": "activate-tab",
|
|
87
|
-
"version": "2.1.0",
|
|
88
|
-
"description": "Emitted just before a tab is shown/activated. Cancelable",
|
|
89
|
-
"args": [
|
|
90
|
-
{
|
|
91
|
-
"arg": "newTabIndex",
|
|
92
|
-
"type": "Number",
|
|
93
|
-
"description": "Tab being activated (0-based index)"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"arg": "prevTabIndex",
|
|
97
|
-
"type": "Number",
|
|
98
|
-
"description": "Tab that is currently active (0-based index). Will be -1 if no current active tab"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"arg": "bvEvent",
|
|
102
|
-
"type": "BvEvent",
|
|
103
|
-
"description": "BvEvent object. Call bvEvent.preventDefault() to cancel"
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"event": "changed",
|
|
109
|
-
"description": "Emitted when a tab is added, removed, or tabs are re-ordered",
|
|
110
|
-
"args": [
|
|
111
|
-
{
|
|
112
|
-
"arg": "currentTabs",
|
|
113
|
-
"type": "Array",
|
|
114
|
-
"description": "Array of the current b-tab instances, in document order"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"arg": "previousTabs",
|
|
118
|
-
"type": "Array",
|
|
119
|
-
"description": "Array of the previous b-tab instances, in document order"
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"event": "input",
|
|
125
|
-
"description": "Emitted when a tab is shown. Used to update the v-model",
|
|
126
|
-
"args": [
|
|
127
|
-
{
|
|
128
|
-
"arg": "tabIndex",
|
|
129
|
-
"type": "Number",
|
|
130
|
-
"description": "Current selected tab index (0-based index)"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
"slots": [
|
|
136
|
-
{
|
|
137
|
-
"name": "default",
|
|
138
|
-
"description": "Content (tabs) to place in the tabs element"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"name": "empty",
|
|
142
|
-
"description": "Renders this slot if no tabs are present"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"name": "tabs-end",
|
|
146
|
-
"description": "Additional tab buttons without tab content placed after content tab buttons"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"name": "tabs-start",
|
|
150
|
-
"description": "Additional tab buttons without tab content placed before content tab buttons"
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"component": "BTab",
|
|
156
|
-
"props": [
|
|
157
|
-
{
|
|
158
|
-
"prop": "buttonId",
|
|
159
|
-
"description": "Use a specific ID for this tab's tab control button. If not provided, one will automatically be generated"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"prop": "lazy",
|
|
163
|
-
"description": "Lazily render this tab's content when shown"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"prop": "noBody",
|
|
167
|
-
"description": "When the parent b-tabs has the 'card' prop set, do not render a card-body wrapper"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"prop": "titleItemClass",
|
|
171
|
-
"description": "CSS class (or classes) to apply to the tab's control button 'li' element"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"prop": "titleLinkAttributes",
|
|
175
|
-
"version": "2.6.0",
|
|
176
|
-
"description": "Attributes to apply to the tab's control button inner link element"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"prop": "titleLinkClass",
|
|
180
|
-
"description": "CSS class (or classes) to apply to the tab's control button inner link element"
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
"events": [
|
|
184
|
-
{
|
|
185
|
-
"event": "click",
|
|
186
|
-
"description": "Emitted when a tab is clicked, or is activated by keyboard navigation",
|
|
187
|
-
"args": [
|
|
188
|
-
{
|
|
189
|
-
"arg": "event",
|
|
190
|
-
"type": "MouseEvent",
|
|
191
|
-
"description": "Original event object"
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
}
|
|
195
|
-
],
|
|
196
|
-
"slots": [
|
|
197
|
-
{
|
|
198
|
-
"name": "title",
|
|
199
|
-
"description": "Slot for custom tab title"
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
}
|