Data Table
Data Table extends the basic Table with toolbar, sorting headers, pagination, and row selection capabilities.
Basic Usage
| Name |
|---|
| Alice |
Page 1
import { Datatable, DatatableToolbar, DatatableHeaderCell, DatatableRow, DatatableCell, DatatablePagination } from "@paramanu/data-display-react"
export default function App() {return ( <Datatable> <DatatableToolbar>Search</DatatableToolbar> <table> <thead> <DatatableRow> <DatatableHeaderCell sortable sortDirection="asc">Name</DatatableHeaderCell> </DatatableRow> </thead> <tbody> <DatatableRow><DatatableCell>Alice</DatatableCell></DatatableRow> </tbody> </table> <DatatablePagination>Page 1</DatatablePagination> </Datatable>)}<div class="pm-datatable pm-datatable--simple pm-datatable--md"><div class="pm-datatable__toolbar">Search</div><table class="pm-datatable__table"> <thead> <tr class="pm-datatable__row"> <th class="pm-datatable__header-cell">Name</th> </tr> </thead> <tbody> <tr class="pm-datatable__row"> <td class="pm-datatable__cell">Alice</td> </tr> </tbody></table><div class="pm-datatable__pagination">Page 1</div></div>Accessibility
- Sortable headers use
aria-sortattribute. - Pagination controls should be keyboard accessible.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "simple" | "striped" | "simple" | Visual style |
size | "sm" | "md" | "lg" | "md" | Cell padding and font size |
hoverable | boolean | false | Row hover highlight |
bordered | boolean | false | Cell borders |
stickyHeader | boolean | false | Sticky header |
selectable | boolean | false | Row selection |