4.0.19 • Published 4 years ago

@zendeskgarden/css-tables v4.0.19

Weekly downloads
528
License
Apache-2.0
Repository
github
Last release
4 years ago

@zendeskgarden/css-tables npm version

This package contains a variety of classes that apply consistent styling to tables, rows, and columns.

Installation

npm install @zendeskgarden/css-tables

Usage

Once installed, table CSS can be accessed via postcss-import.

@import '@zendeskgarden/css-tables';

Component CSS provides styling for the following basic table structure.

<table class="c-table">
  <caption class="c-table__caption">
    Table Caption
  </caption>
  <thead>
    <tr class="c-table__row c-table__row--header">
      <th class="c-table__row__cell">...</th>
      <!-- additional header columns... -->
    </tr>
    <!-- additional header rows... -->
  </thead>
  <tbody>
    <tr class="c-table__row">
      <td class="c-table__row__cell">...</td>
      <!-- additional body columns... -->
    </tr>
    <!-- additional body rows... -->
  </tbody>
</table>

Modifications

See http://zendeskgarden.github.io/css-components/tables/ for a variety of table modification classes, including: small and large sizing, zebra-striped rows, minimized and truncated cells, in-context menu overflow, support for RTL, etc.

Accessibility

Use the following checklist to ensure your tables follow accessibility best practice.

  • Every table must include a <caption> element with the title of the table as its first descendant. The .c-table__caption BEM component provides minimal styling (along with support for RTL) and is meant to be enhanced with custom CSS for individual table designs.
  • Use aria-sort to indicate column sort order.
  • Use a button to handle keyboard toggle for a .c-table__row__cell__sortable component. Combined with the previous point, the HTML would look something like this:
<th aria-sort="ascending" class="c-table__row__cell">
  <button class="c-table__row__cell__sortable" type="button">Sortable Column</button>
</th>
  • Use a button with aria-haspopup to handle .c-table__row__cell__overflow components. Again, the HTML would be similar to:
<td class="c-table__row__cell c-table__row__cell--overflow">
  <button aria-haspopup="true" class="c-table__row__cell__overflow" type="button">
    <ul aria-hidden="true" class="c-menu c-menu--down" role="menu">
      <li class="c-menu__item" role="menuitem">...</li>
    </ul>
  </button>
</td>

Behavior

See the <Table> component for virtual scrolling and intended mouse and keyboarding behaviors.

4.0.19

4 years ago

4.0.18

4 years ago

4.0.17

5 years ago

4.0.16

5 years ago

4.0.15

5 years ago

4.0.14

5 years ago

4.0.13

5 years ago

4.0.12

5 years ago

4.0.11

5 years ago

4.0.10

5 years ago

4.0.9

5 years ago

4.0.8

5 years ago

4.0.7

5 years ago

4.0.6

5 years ago

4.0.5

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.2.1

5 years ago

3.2.0

6 years ago

3.1.7

6 years ago

3.1.6

6 years ago

3.1.5

6 years ago

3.1.4

6 years ago

3.1.3

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago