Tables are used to present data sets in a simple and organized way.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Tables can be bordered by applying the modifier class -bordered
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -bordered">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Remove all borders by applying the modifier class -borderless
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -borderless">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Alternate the table row color by applying the modifier class -striped
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -striped">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Enable a hover state by applying the modifier class -hover
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -hover">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Enable portal styling by applying class -portal
.
To display a row in active / selected state, apply class -active
to the tr
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -portal">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#">Name 1</a></td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td><a href="#">Name 2</a></td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr class="-active">
<td><a href="#">Name 3</a></td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Chi offers a wide variety of modifiers to express different row states.
Disable a row by applying the attribute disabled="disabled"
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr class="-disabled">
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr disabled="disabled">
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a success state by applying the modifier class -row--success
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr class="-row--success">
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr class="-row--success">
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a warning state by applying the modifier class -row--warning
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr class="-row--warning">
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr class="-row--warning">
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a danger state by applying the modifier class -row--danger
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr class="-row--danger">
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr class="-row--danger">
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render an info state by applying the modifier class -row--info
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr class="-row--info">
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr class="-row--info">
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
To express column sorting, apply the class -sorted
with one of
the following modifiers: -ascending
or -descending
.
Name
|
ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr>
<th class="-sorted -ascending">
<div>Name</div>
</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Name
|
ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr>
<th class="-sorted -descending">
<div>Name</div>
</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Chi also supports additional content alignment with inline text align utilities
applying the modifier class -text--left
, -text--center
or -text--right
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr>
<th class="-text--left">Name</th>
<th class="-text--center">ID</th>
<th class="-text--right">Last login</th>
</tr>
</thead>
<tbody>
<tr class="-md">
<td class="-text--left">Name 1</td>
<td class="-text--center">name-1</td>
<td class="-text--right">Dec 18, 2020 3:26 PM</td>
</tr>
<tr class="-md">
<td class="-text--left">Name 2</td>
<td class="-text--center">name-2</td>
<td class="-text--right">Dec 18, 2020 2:38 AM</td>
</tr>
<tr class="-md">
<td class="-text--left">Name 3</td>
<td class="-text--center">name-3</td>
<td class="-text--right">Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
|
Name
|
ID | Last login |
---|---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM | |
Name 2 | name-2 | Dec 18, 2020 2:38 AM | |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table">
<thead>
<tr>
<th>
<div class="-lh--1">
<input class="a-checkbox__input" type="checkbox" id="chk-1" />
<label class="a-checkbox__label" for="chk-1">
<div class="-sr--only">Label</div>
</label>
</div>
</th>
<th class="-sorted -ascending">
<div>Name</div>
</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr class="-row--info">
<td class="-lh--1">
<input class="a-checkbox__input" type="checkbox" id="chk-1-01" checked="checked" />
<label class="a-checkbox__label" for="chk-1-01">
<div class="-sr--only">Label</div>
</label>
</td>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td class="-lh--1">
<input class="a-checkbox__input" type="checkbox" id="chk-1-02" />
<label class="a-checkbox__label" for="chk-1-02">
<div class="-sr--only">Label</div>
</label>
</td>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td class="-lh--1">
<input class="a-checkbox__input" type="checkbox" id="chk-1-03" />
<label class="a-checkbox__label" for="chk-1-03">
<div class="-sr--only">Label</div>
</label>
</td>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
If the section
height is smaller than the table
height, the table
header will be fixed positioned and
content will scroll.
Tables must be wrapped in a <section class="a-table -fixed--header">
Name
|
ID
|
Last login
|
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<section class="a-table -fixed--header" style="height: 150px">
<div>
<table>
<thead>
<tr>
<th>
<div>Name</div>
</th>
<th>
<div>ID</div>
</th>
<th>
<div>Last login</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
</div>
</section>
Chi supports the following table sizes: -xs
, -sm
, -md
,
-lg
, -xl
. The default size is -md
.
To change the size of a table, apply the size class to a-table
. You may also
apply size classes to tr
elements to customize the size of individual table rows.
Render a -xs size by applying the modifier class -xs
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -xs">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a -sm size by applying the modifier class -sm
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -sm">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a -md size by applying the modifier class -md
. -md is the default size.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -md">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a -lg size by applying the modifier class -lg
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -lg">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>
Render a -xl size by applying the modifier class -xl
.
Name | ID | Last login |
---|---|---|
Name 1 | name-1 | Dec 18, 2020 3:26 PM |
Name 2 | name-2 | Dec 18, 2020 2:38 AM |
Name 3 | name-3 | Nov 5, 2020 10:15 AM |
<table class="a-table -xl">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Last login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name 1</td>
<td>name-1</td>
<td>Dec 18, 2020 3:26 PM</td>
</tr>
<tr>
<td>Name 2</td>
<td>name-2</td>
<td>Dec 18, 2020 2:38 AM</td>
</tr>
<tr>
<td>Name 3</td>
<td>name-3</td>
<td>Nov 5, 2020 10:15 AM</td>
</tr>
</tbody>
</table>