Skip to content

Commit ef7a803

Browse files
hannahisslouismaximepitonjulien-deramond
authored
fix(table): reduce space after checkboxes in row selection (#1272)
Co-authored-by: Louis-Maxime Piton <louismaxime.piton@orange.com> Co-authored-by: Julien Déramond <julien.deramond@orange.com>
1 parent 34de2c4 commit ef7a803

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

scss/_tables.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
> tbody {
4949
vertical-align: inherit;
5050
}
51+
52+
// Boosted mod
53+
// When using checkboxes in the first column, force width to ensure correct spacing on this column
54+
&.has-checkbox tr > :first-child {
55+
width: $spacer * 2;
56+
max-width: $spacer * 2;
57+
}
58+
// End mod
5159
}
5260

5361
.table-group-divider {

site/content/docs/5.2/content/tables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ Use `.table-responsive{-sm|-md|-lg|-xl|-xxl}` as needed to create responsive tab
633633
## Rich content tables
634634

635635
### Row selection
636-
Add a [`.form-check` div]({{< docsref "/forms/checks-radios#checks" >}}) within `<th>` and `<td>` to display checkboxes and use the `checked` attribute.
636+
Add a [`.form-check` div]({{< docsref "/forms/checks-radios#checks" >}}) within `<th>` and `<td>` to display checkboxes and use the `checked` attribute, and use `.has-checkbox` on the table to get correct spacing on the first column.
637637

638638
{{< callout info >}}
639639
#### Selection feature
@@ -642,7 +642,7 @@ The selection behavior isn't implemented yet. This feature will be delivered wit
642642
{{< /callout >}}
643643

644644
<div>
645-
<table class="table table-sm table-hover table-responsive">
645+
<table class="table table-sm table-hover table-responsive has-checkbox">
646646
<thead>
647647
<tr>
648648
<th scope="col">
@@ -778,7 +778,7 @@ The selection behavior isn't implemented yet. This feature will be delivered wit
778778

779779
```html
780780
<div>
781-
<table class="table table-sm table-hover table-responsive">
781+
<table class="table table-sm table-hover table-responsive has-checkbox">
782782
<thead>
783783
<tr>
784784
<th scope="col">
@@ -840,7 +840,7 @@ The selection behavior isn't implemented yet. This feature will be delivered wit
840840
Use SVG to display thumbnails or icons in your table data cell elements.
841841

842842
<div>
843-
<table class="table table-sm table-hover table-responsive align-middle">
843+
<table class="table table-sm table-hover table-responsive align-middle has-checkbox">
844844
<thead>
845845
<tr>
846846
<th scope="col">

site/content/docs/5.2/migration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ If you need more details about the changes, please refer to the [v5.2.2 release]
3333

3434
- <span class="badge bg-warning">Warning</span> All forms examples have been modified to add a `.mt-2` to all submit buttons in order to always have 30px between the last form control and the button. Please reflect this modification into your websites.
3535

36+
### Contents
37+
38+
- **Tables**
39+
- <span class="badge bg-warning">Warning</span> Reintroduction of `.has-checkbox` from v4 to correct spacing of first column when having row selection.
40+
3641
### Examples
3742

3843
- <span class="badge bg-success">New</span> There is a new RTL section in the examples.

0 commit comments

Comments
 (0)