Skip to content

TableLinkRow

Open .md
Live preview

Loading example…

Fully navigable table row: the real link lives in the first cell and, via a stretched link (positioned <tr> + anchor ::before at inset-0), its click area covers the whole row without duplicating the link per cell.

import { TableLinkRow } from "@jcsoftdev/ui/containers";

Single-component entry points tree-shake to just this component: @jcsoftdev/ui/containers/table.

<TableLinkRow aria-label="Inventario de productos">
<>
<TableHead>
<tr>
<TableHeaderCell>Producto</TableHeaderCell>
<TableHeaderCell>SKU</TableHeaderCell>
<TableHeaderCell alignRight>Stock</TableHeaderCell>
<TableHeaderCell alignRight>Precio</TableHeaderCell>
</tr>
</TableHead>
<TableBody>
{inventory.map((item) => (
<TableRow key={item.sku}>
<TableCell>
{item.name} {item.low ? <Chip tone="danger">Stock bajo</Chip> : null}
</TableCell>
<TableCell>{item.sku}</TableCell>
<TableCell alignRight>{item.stock}</TableCell>
<TableCell alignRight>{item.price}</TableCell>
</TableRow>
))}
</TableBody>
</>
</TableLinkRow>
Prop Type Default Description
href * string Row destination: rendered as a real <a href> in the first cell.
primary * ReactNode Content of the first cell, wrapped by the anchor.
primaryColumnId string columnId of the first cell, so that column can be pinned.
children ReactNode Additional <td> cells of the row.

* marks a required prop.

It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).

packages/ui/src/containers/table/table.tsx