labsUI

Table

Server-safe semantic <table> in a scrolling card: header, body, footer and caption, striped rows, tinted selected rows, and sortable headers that set aria-sort and flip their arrow.

npx @kznlabs/labsui add table
Guild members · 0 selected
Role
Brooklyn Simmons
Bot12,904
Jane Cooper
Admin4,210
Wade Warren
Moderator1,882
Esther Howard
Member642
Cameron Williamson
Member97
Total19,735

<Table>

A real <table> in a card that scrolls sideways on narrow screens (and is keyboard-scrollable then).

  • containerClassName
    string

    Classes for the scrolling card around the table.

  • stripeddefault false
    boolean

    Alternating row shading.

PropTypeDefault
containerClassName

Classes for the scrolling card around the table.

string—
striped

Alternating row shading.

booleanfalse

Also accepts every <table> prop.

<TableHeader>

Also accepts every <thead> prop (none of its own).

<TableBody>

Also accepts every <tbody> prop (none of its own).

<TableFooter>

Also accepts every <tfoot> prop (none of its own).

<TableRow>

Pass data-state="selected" (or aria-selected) to tint a selected row.

Also accepts every <tr> prop (none of its own).

<TableHead>

  • onSort
    () => void

    Called when the header button is pressed. Requires sort.

  • sort
    "ascending" | "descending" | "none"

    Makes the column sortable: sets aria-sort and shows the direction arrow.

PropTypeDefault
onSort

Called when the header button is pressed. Requires sort.

() => void—
sort

Makes the column sortable: sets aria-sort and shows the direction arrow.

"ascending" | "descending" | "none"—

Also accepts every <th> prop.

<TableCell>

Also accepts every <td> prop (none of its own).

<TableCaption>

Also accepts every <caption> prop (none of its own).

* required. Every component also takes className.