Skip to content

Table

import { Table } from 'yarcl';
Invoices
InvoiceCustomerStatusAmount
INV-1042Ada LovelacePaid$1,200.00
INV-1043Grace HopperPending$860.50
INV-1044Alan TuringOverdue$45.00
INV-1045Katherine JohnsonPaid$13,075.25
<Table density="compact" striped interactive caption="Invoices">
<Table.Head>
<Table.Row>
<Table.HeaderCell>Customer</Table.HeaderCell>
<Table.HeaderCell align="end">Amount</Table.HeaderCell>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>Ada Lovelace</Table.Cell>
<Table.Cell align="end">$1,200.00</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
  • density accepts the keys of your density group.
  • align="end" also uses tabular numbers, so amounts line up.
  • caption is visible and names the table for screen readers.
  • The table scrolls horizontally when it doesn’t fit.
PropTypeDefaultDescription
captionReactNodeVisible caption describing the table. Also its accessible name.
densityDensityconfigconfig.defaults.densityCell padding and font size, from the density config.
interactivebooleanHighlights the row under the pointer. Use when rows are clickable.
stripedbooleanShades every other row.
PropTypeDefaultDescription
alignCellAlign'start'Content alignment.