🌐 AI搜索 & 代理 主页
Skip to content

Commit e35ad51

Browse files
authored
docs(table): document table active variant in selectable rows section (#4097)
1 parent 1bb47fd commit e35ad51

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

docs/markdown/reference/color-variants/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
- `dark` - <span class="text-dark">Dark</span>
1717

1818
The base variants will translate to various Bootstrap v4 contextual class names based on the
19-
component (and variant purpose) where they are used.
19+
component (and variant purpose) where they are used. See the sections below for details.
2020

2121
## Background and border variants
2222

2323
All the **base variants** plus:
2424

2525
- `transparent`
2626

27-
These translate to class names `bg-<variant>` for backgrounds and `border-<variant>` for borders.
27+
These translate to class names `bg-{variant}` for backgrounds and `border-{variant}` for borders.
2828

29-
These variants are used by components (such as `<b-card>`, `<b-jumbotron>` and `<b-modal>`) that
30-
provide `bg-variant`, `*-bg-variant`, `border-variant` and `*-border-variant` props
29+
These variants are used by components (such as `<b-card>`, `<b-jumbotron>`, `<b-modal>`, etc.) that
30+
provide `bg-variant`, `*-bg-variant`, `border-variant` and `*-border-variant` props.
3131

3232
## Text variants
3333

@@ -37,10 +37,10 @@ All the **base variants** plus:
3737
- `white`
3838
- `black`
3939

40-
These translate to class names `text-<variant>`
40+
These translate to class names `text-{variant}`
4141

42-
These variants are used by components (such as `<b-card>`, `<b-jumbotron>` and `<b-modal>`) that
43-
provide `text-variant` and `*-text-variant` props
42+
These variants are used by components (such as `<b-card>`, `<b-jumbotron>`, `<b-modal>`, etc.) that
43+
provide `text-variant` and `*-text-variant` props.
4444

4545
## Component specific variants
4646

@@ -51,22 +51,22 @@ Some Bootstrap v4 components require additional CSS styling, or additional pseud
5151

5252
All the **base variants**
5353

54-
These translate to class names `alert-<variant>`.
54+
These translate to class names `alert-{variant}`.
5555

5656
### Badge variants
5757

5858
All the **base variants**
5959

60-
These translate to class names `badge-<variant>`.
60+
These translate to class names `badge-{variant}`.
6161

6262
### Button variants
6363

6464
All the **base variants** plus:
6565

66-
- `outline-<base variant>`
67-
- `link` which renders the button with the look of a link but retains button padding and margins.
66+
- `outline-{base variant}` which generates an outline button version of the base variant
67+
- `link` which renders the button with the look of a link but retains button padding and margins
6868

69-
These translate to class names `btn-<variant>` and `btn-outline-<variant>`.
69+
These translate to class names `btn-{variant}` and `btn-outline-{variant}`.
7070

7171
Note the `link` variant does not have an outline version.
7272

@@ -76,27 +76,30 @@ All the **base variants** plus:
7676

7777
- `active`
7878

79-
These variants translate to class names `table-<variant>`.
79+
These variants translate to class names `table-{variant}`.
8080

81-
When the table has the `dark` prop set, the variants translate to the `bg-<variant>` classes.
81+
When the table has the `dark` prop set, the variants translate to the `bg-{variant}` classes.
82+
83+
Note that the `active` variant is only applicable to `<tr>` elements within the `<tbody>`, and can
84+
not be applied to individual table cells or used as the `table-variant`.
8285

8386
### Popover variants
8487

8588
All the **base variants**
8689

87-
These translate to BootstrapVue custom class names `b-popover-<variant>`.
90+
These translate to BootstrapVue custom class names `b-popover-{variant}`.
8891

8992
### Tooltip variants
9093

9194
All the **base variants**
9295

93-
These translate to BootstrapVue custom class names `b-tooltip-<variant>`.
96+
These translate to BootstrapVue custom class names `b-tooltip-{variant}`.
9497

9598
### Toast variants
9699

97100
All the **base variants**
98101

99-
These translate to BootstrapVue custom class names `b-toast-<variant>`.
102+
These translate to BootstrapVue custom class names `b-toast-{variant}`.
100103

101104
## Using variant classes
102105

src/components/table/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,18 @@ element. Rows that are selected rows will have a class of `b-row-selected` appli
15251525
element.
15261526

15271527
Use the prop `selected-variant` to apply a Bootstrap theme color to the selected row(s). Note, due
1528-
to the order that the table variants are defined in Bootstrap's CSS, any row-variant may take
1528+
to the order that the table variants are defined in Bootstrap's CSS, any row-variant _might_ take
15291529
precedence over the `selected-variant`. You can set `selected-variant` to an empty string if you
15301530
will be using other means to convey that a row is selected (such as a scoped field slot in the below
15311531
example).
15321532

1533+
The `selected-variant` can be any of the
1534+
[standard (or custom) bootstrap base color variants](/docs/reference/color-variants), or the special
1535+
[table `active` variant](/docs/reference/color-variants#table-variants).
1536+
1537+
For accessibility reasons (specifically for color blind users), it is highly recommended to always
1538+
provide some other visual means of conveying that a row is selected, as shown in the example below.
1539+
15331540
```html
15341541
<template>
15351542
<div>
@@ -1541,7 +1548,7 @@ example).
15411548
ref="selectableTable"
15421549
selectable
15431550
:select-mode="selectMode"
1544-
selected-variant="success"
1551+
selected-variant="active"
15451552
:items="items"
15461553
:fields="fields"
15471554
@row-selected="onRowSelected"

0 commit comments

Comments
 (0)