Skip to main content

Tables

If you wish to build a simple data table that does not need any advanced features, it's often simpler to do it declaratively, rather than using a code-first 3rd party grid library. The BlueWater Design System offers basic styling classes for the native table element for these scenarios.

Basic Usage

Apply the .bw-table class to any HTML table element to get the BlueWater styling:

AccountTypeNameAmount
0000-00000-001IDoe, John$76.83
0000-00000-002IDoe, jane$58.92
0000-00000-003IBob, Jergle$22.47
<table class="bw-table">
<thead>
<tr>
<th>Account</th>
<th>Type</th>
<th>Name</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>0000-00000-001</td>
<td>I</td>
<td>Doe, John</td>
<td>$76.83</td>
</tr>
<tr>
<td>0000-00000-002</td>
<td>I</td>
<td>Doe, jane</td>
<td>$58.92</td>
</tr>
<tr>
<td>0000-00000-003</td>
<td>I</td>
<td>Bob, Jergle</td>
<td>$22.47</td>
</tr>
</tbody>
</table>

Features

Note: More features may be added in the future.

Hover Effects

Add the .bw-table--hover class to table rows to enable hover effects:

<tr class="bw-table--hover">
<td>Content</td>
</tr>

Customization

The table system uses CSS custom properties that can be overridden to customize the appearance:

Color Variables

VariableDefault ValueDescription
--bw-table-header-bg#1971b6Header background color
--bw-table-header-textrgb(253, 253, 253)Header text color
--bw-table-odd-row-bg#e3f3e3Odd row background color
--bw-table-even-row-bg#ffffffEven row background color
--bw-table-text-colorrgb(24, 29, 39)Body text color
--bw-table-border-color#E9EAEBBorder color
--bw-table-hover-bgrgba(25, 113, 182, 0.1)Hover background color

Typography Variables

VariableDefault ValueDescription
--bw-table-header-font-size10pxHeader font size
--bw-table-body-font-size12pxBody font size
--bw-table-header-font-weight700Header font weight
--bw-table-body-font-weight400Body font weight

Spacing Variables

VariableDefault ValueDescription
--bw-table-header-padding-y9pxHeader vertical padding
--bw-table-header-padding-x8pxHeader horizontal padding
--bw-table-cell-padding-y7pxCell vertical padding
--bw-table-cell-padding-x8pxCell horizontal padding

Layout Variables

VariableDefault ValueDescription
--bw-table-border-width1pxBorder width

Customization Example

To customize the table colors for a specific use case:

.custom-table {
--bw-table-header-bg: #2c3e50;
--bw-table-odd-row-bg: #f8f9fa;
--bw-table-even-row-bg: #ffffff;
--bw-table-hover-bg: rgba(44, 62, 80, 0.1);
}
<table class="bw-table custom-table">
<!-- table content -->
</table>