Skip to Content
BlocksTableBlock

TableBlock

A data table block with header, columns, and built-in pagination.

Import

import { TableBlock } from "@raydenui/ui/blocks";

Usage

<TableBlock title="Team Members" description="Manage your team members and their roles" columns={["Name", "Email", "Role", "Status"]} rows={users.map((user) => ({ id: user.id, cells: [ <div className="flex items-center gap-3"> <Avatar type="image" src={user.avatar} size="sm" /> {user.name} </div>, user.email, user.role, <Badge color={user.active ? "success" : "neutral"}> {user.active ? "Active" : "Inactive"} </Badge>, ], }))} onRowClick={(id) => viewUser(id)} />

With Pagination

const [page, setPage] = useState(1); <TableBlock title="Products" columns={["Name", "SKU", "Price", "Stock"]} rows={products.map((p) => ({ id: p.id, cells: [p.name, p.sku, `$${p.price}`, p.stock], }))} pagination={{ currentPage: page, totalPages: 10, onPageChange: setPage, }} />

With Actions

<TableBlock title="Orders" description="Recent customer orders" columns={["Order ID", "Customer", "Total", "Actions"]} rows={orders.map((order) => ({ id: order.id, cells: [ order.id, order.customerName, `$${order.total}`, <Button size="sm" variant="text">View</Button>, ], }))} />

Props

PropTypeDefaultDescription
titlestring—Header title
descriptionstring—Header description
columnsstring[]—Column headers (required)
rowsTableBlockRow[]—Table rows (required)
onRowClick(id: string) => void—Row click handler
paginationPaginationProps—Pagination config
classNamestring—Additional CSS classes

TableBlockRow

PropTypeRequiredDescription
idstringYesUnique row identifier
cellsReactNode[]YesCell content array

PaginationProps

PropTypeRequiredDescription
currentPagenumberYesCurrent page number
totalPagesnumberYesTotal number of pages
onPageChange(page: number) => voidYesPage change handler

Accessibility

  • Uses semantic <table> elements
  • Row click handlers are keyboard accessible
  • Pagination controls have proper ARIA labels
Last updated on