Table

Tables are used to present data sets in a simple and organized way.

Examples

No Border

Remove all borders by applying the modifier class -no-border.

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="chi-table -no-border">
    <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>

Striped

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="chi-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>

Hover

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="chi-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>

Portal styled 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="chi-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>

Inverse styled table

Enable inverse styling by applying class -inverse.

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="chi-table -inverse">
    <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 class="-active">
            <td>Name 3</td>
            <td>name-3</td>
            <td>Nov 5, 2020 10:15 AM</td>
        </tr>
    </tbody>
</table>

Row States

Chi offers a wide variety of modifiers to express different row states.

Disabled

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="chi-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>

Success

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="chi-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>

Warning

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="chi-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>

Danger

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="chi-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>

Info

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="chi-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>

Column Sorting

To express column sorting, apply the class -sorted with one of the following modifiers: -ascending or -descending.

Ascending

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="chi-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>

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="chi-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>

Content alignment

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
David Navarro david 2017 3:26 PM
Diego Sanjuan diego 2017 3:26 PM
Manuel Martin manuel 2017 3:26 PM
<table class="chi-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">David Navarro</td>
            <td class="-text--center">david</td>
            <td class="-text--right">2017 3:26 PM</td>
        </tr>
        <tr class="-md">
            <td class="-text--left">Diego Sanjuan</td>
            <td class="-text--center">diego</td>
            <td class="-text--right">2017 3:26 PM</td>
        </tr>
        <tr class="-md">
            <td class="-text--left">Manuel Martin</td>
            <td class="-text--center">manuel</td>
            <td class="-text--right">2017 3:26 PM</td>
        </tr>
    </tbody>
</table>

Additional Sizes

Chi also supports additional table sizes: -xs, -sm, -md, -lg, -xl. The default size is -md.

Size -xs

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="chi-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>

Size -sm

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="chi-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>

Size -md

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="chi-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>

Size -lg

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="chi-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>

Size -xl

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="chi-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>

Selectable

Name
ID Last login
David Navarro david Dec 18, 2017 3:26 PM
Diego Sanjuan diego Dec 18, 2017 2:38 AM
Manuel Martin manuel Nov 5, 2017 10:15 AM
<table class="chi-table">
  <thead>
      <tr>
          <th>
            <div class="-lh--1">
              <input class="chi-checkbox__input" type="checkbox" id="chk-1" />
              <label class="chi-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="chi-checkbox__input" type="checkbox" id="chk-1-01" checked="checked" />
            <label class="chi-checkbox__label" for="chk-1-01">
              <div class="-sr--only">Label</div>
            </label>
          </td>
          <td>David Navarro</td>
          <td>david</td>
          <td>Dec 18, 2017 3:26 PM</td>
      </tr>
      <tr>
          <td class="-lh--1">
            <input class="chi-checkbox__input" type="checkbox" id="chk-1-02" />
            <label class="chi-checkbox__label" for="chk-1-02">
              <div class="-sr--only">Label</div>
            </label>
          </td>
          <td>Diego Sanjuan</td>
          <td>diego</td>
          <td>Dec 18, 2017 2:38 AM</td>
      </tr>
      <tr>
          <td class="-lh--1">
            <input class="chi-checkbox__input" type="checkbox" id="chk-1-03" />
            <label class="chi-checkbox__label" for="chk-1-03">
                <div class="-sr--only">Label</div>
            </label>
          </td>
          <td>Manuel Martin</td>
          <td>manuel</td>
          <td>Nov 5, 2017 10:15 AM</td>
      </tr>
  </tbody>
</table>

Scrollable

If the section height is smaller than the table height, the table header will be fixed positioned and content will scroll.

Requirements

Tables must be wrapped in a <section class="chi-table -fixed--header">

Name
ID
Last login
David Navarro david Dec 18, 2017 3:26 PM
Diego Sanjuan diego Dec 18, 2017 2:38 AM
Manuel Martin manuel Nov 5, 2017 10:15 AM
<section class="chi-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>David Navarro</td>
                    <td>david</td>
                    <td>Dec 18, 2017 3:26 PM</td>
                </tr>
                <tr>
                    <td>Diego Sanjuan</td>
                    <td>diego</td>
                    <td>Dec 18, 2017 2:38 AM</td>
                </tr>
                <tr>
                    <td>Manuel Martin</td>
                    <td>manuel</td>
                    <td>Nov 5, 2017 10:15 AM</td>
                </tr>
            </tbody>
        </table>
    </div>
</section>

Web Component

Properties

Web component coming soon

Accessibility

Accessibility guidelines coming soon