Skip to content

Search Feitio

↵ opens the first↑↓ chooseEsc closes

Table

A table arranges many items of the same kind in rows and columns, to compare and act. On mobile, each row becomes a card.

On this page

Playground

NameWhenStatusRunsActions
Weekly backupSunday, 3 amOn time48Edit Weekly backup
Water the plantsTuesday, 9 amLate3Edit Water the plants
Density
Caption
Rows
Background
HTML
<div style="inline-size: 100%"><div class="feitio-table-scroll" tabindex="0" role="region" aria-label="Name"><table class="feitio-table"><thead><tr><th scope="col">Name</th><th scope="col">When</th><th scope="col">Status</th><th scope="col" data-align="end">Runs</th><th scope="col"><span class="feitio-visually-hidden">Actions</span></th></tr></thead><tbody><tr><td class="title">Weekly backup</td><td data-label="When">Sunday, 3 am</td><td data-label="Status"><span class="feitio-tag" data-status="ok"><svg class="feitio-icon" aria-hidden="true"><use href="/feitio/icons/sprite.svg#feitio-check"></use></svg>On time</span></td><td data-align="end" data-label="Runs">48</td><td class="actions"><a class="feitio-button" href="#playground" data-size="small">Edit<span class="feitio-visually-hidden"> Weekly backup</span></a></td></tr><tr><td class="title">Water the plants</td><td data-label="When">Tuesday, 9 am</td><td data-label="Status"><span class="feitio-tag" data-status="warn"><svg class="feitio-icon" aria-hidden="true"><use href="/feitio/icons/sprite.svg#feitio-warn"></use></svg>Late</span></td><td data-align="end" data-label="Runs">3</td><td class="actions"><a class="feitio-button" href="#playground" data-size="small">Edit<span class="feitio-visually-hidden"> Water the plants</span></a></td></tr></tbody></table></div></div>

When to use

When not to use

Examples

Schedules
NameWhenStatusRunsActions
Weekly backupSunday, 3 amOn time48Edit weekly backup
Water the plantsTuesday, 9 amLate3Edit water the plants
Monthly reportThe 1st, 8 amPaused1.204Edit monthly report

A work table

Caption, header with the ink line, numbers on the right and each row’s action at the end.

Show code
HTML
<div class="feitio-table-scroll" tabindex="0" role="region" aria-labelledby="agendamentos">
  <table class="feitio-table">
    <caption id="agendamentos">Agendamentos</caption>
    <thead><tr><th scope="col">Nome</th>…<th scope="col" data-align="end">Disparos</th></tr></thead>
    <tbody><tr><td class="title">Backup semanal</td>…<td data-align="end" data-label="Disparos">48</td></tr></tbody>
  </table>
</div>
Schedules (2)
NameWhenStatusRunsActions
Weekly backupSunday, 3 amOn time48Edit weekly backup
Water the plantsTuesday, 9 amLate3Edit water the plants
Monthly reportThe 1st, 8 amPaused1.204Edit monthly report

On mobile

In a box narrower than 40rem, each row becomes a card: the name on top, each value with its column name beside it (data-label), the actions below.

Show code
HTML
<td class="title">Backup semanal</td>
<td data-label="Quando">Domingo, 3h</td>
TaskDue
Review the contract10 nov
Replace the photos14 nov

Sort by header

The sorting column is a link: the server returns the sorted page. The sorted column gets aria-sort and the arrow.

Show code
HTML
<th scope="col" aria-sort="ascending"><a href="?ordem=prazo">Prazo…</a></th>
SelectTaskDue
Review the contract10 nov
Replace the photos14 nov

Batch action

A box per row and the batch actions on top, in small buttons. It is a form: the ticked boxes go along with the button pressed.

Show code
HTML
<form action="/tarefas/lote" method="post">
  <button type="submit" name="acao" value="concluir" class="feitio-button" data-size="small">Concluir selecionadas</button>
  …
  <td class="select"><input type="checkbox" name="ids" value="12" aria-label="Selecionar revisar o contrato"></td>
</form>

With no rows, the table becomes an EmptyState, in place of the rows. Never a header alone with nothing below.

Anatomy

Schedules
NameRunsActions
Backup48Edit
  1. Caption: the table’s name, read by screen readers.
  2. Header: soft text, with the ink line below.
  3. Row: separated from the next by a hairline.
  4. Numbers on the right, with same-width figures.
  5. Row action: a small button, at the end.

States

Do and don’t

Do

ItemValue
Photos1.204
Videos38

Numbers on the right: the digits line up and comparison is by eye.

Don’t

ItemValue
Photos1.204
Videos38

Everything centered: the numbers do not line up.

Do

BackupEdit

The action with a word, small, at the end of the row.

Don’t

Backup
Plants

Alternating stripes and icon-only actions: noise, and nobody knows what the icon does.

Writing

Accessibility

Attributes

AttributeValuesWhat for
class="feitio-table"requiredHairlines, header with the ink line, same-width figures.
class="feitio-table-scroll" tabindex="0"aroundMeasures its own width: narrow, it turns into cards; medium, it scrolls. With tabindex="0", role="region" and a name.
class="title"on the name cellThe card title on mobile.
data-labelon the other cellsThe column name, next to the value on the card.
data-align="end"on the number columnNumbers on the right.
class="actions"on the actions cellSmall buttons, at the end.
aria-sort"ascending", "descending"On the sorted column.
Top