Table wraps standard HTML table elements with styling for variants, sizes, hoverable rows, bordered cells, and sticky headers.
Basic Usage
import { Table, TableContainer, TableHead, TableBody, TableRow, TableHeaderCell, TableCell } from "@paramanu/data-display-react"
export default function App() {
<TableHeaderCell>Name</TableHeaderCell>
<TableHeaderCell>Role</TableHeaderCell>
<TableCell>Alice</TableCell>
<TableCell>Engineer</TableCell>
<div class="pm-table__container">
<table class="pm-table pm-table--simple pm-table--md pm-table--layout-auto">
<thead class="pm-table__head">
<tr class="pm-table__row">
<th class="pm-table__header-cell">Name</th>
<th class="pm-table__header-cell">Role</th>
<tbody class="pm-table__body">
<tr class="pm-table__row">
<td class="pm-table__cell">Alice</td>
<td class="pm-table__cell">Engineer</td>
Accessibility
- Use proper
<thead>, <tbody>, <th> elements for screen reader navigation.
- Add
<caption> for table descriptions.
Best Practices
- Use
striped variant for tables with many rows to improve readability.
- Enable
hoverable for interactive tables with row selection.
Props
| Prop | Type | Default | Description |
|---|
variant | "simple" | "striped" | "simple" | Visual style |
size | "sm" | "md" | "lg" | "md" | Cell padding and font size |
layout | "auto" | "fixed" | "auto" | Column width algorithm |
hoverable | boolean | false | Row hover highlight |
bordered | boolean | false | Cell borders |
stickyHeader | boolean | false | Sticky header row |
CSS Classes
| Class | Description |
|---|
pm-table | Base table class |
pm-table__container | Scrollable wrapper |
pm-table__head | <thead> element |
pm-table__body | <tbody> element |
pm-table__row | <tr> element |
pm-table__header-cell | <th> element |
pm-table__cell | <td> element |