Data table for displaying structured information in rows and columns. Supports divider styles, mobile layout, and RTL.
Loading demo: table-real-world
npx sdaia-ui@latest add table
import { Table } from '@/components/ui/Table';<Table />Basic table with no dividers.
Loading demo: table-default
Table with horizontal dividers between rows.
Loading demo: table-horizontal-dividers
Table with vertical dividers between columns.
Loading demo: table-vertical-dividers
Table with both horizontal and vertical dividers.
Loading demo: table-full-dividers
Table layout optimised for mobile screens.
Loading demo: table-mobile
Pick the state that matches what happened. Loading shows skeleton rows under the real header and keeps the pagination; Empty explains a result with no rows; Error offers a way to try again. Show skeleton rows only after about 300 ms so quick loads do not flash.
Skeleton rows under the real header. The table has aria-busy and the loading text is announced.
Loading demo: table-state-loading
No rows to show. Offer a way to clear the filters.
Loading demo: table-state-empty
The request failed. Retry shows the loading state, then the rows.
Loading demo: table-state-error
The columns, skeleton rows and messages mirror for Arabic.
Loading demo: table-state-rtl
Prop | Type | Default | Required |
|---|---|---|---|
state | "default" | "loading" | "empty" | "error" | "default" | optional |
loadingRowCount | number | 5 | optional |
emptyState | { illustration?, title?, description?, actionLabel?, onAction? } | — | optional |
errorState | { illustration?, title?, description?, actionLabel?, onAction? } | — | optional |
labels.loading | string | "Loading data" | optional |
labels | TableLabels | English strings | optional |
Props for the Table component.
Prop | Type | Default | Required |
|---|---|---|---|
title | ReactNode | - | optional |
description | ReactNode | - | optional |
headerActions | ReactNode | - | optional |
showMoreIcon | boolean | - | optional |
onMoreClick | () => void | - | optional |
hideHeader | boolean | false | optional |
columns | TableColumn[] | - | required |
rows | TableRowData[] | - | required |
divider | 'none' | 'horizontal' | 'vertical' | 'both' | 'none' | optional |
sortKey | string | - | optional |
sortDirection | 'asc' | 'desc' | - | optional |
onSort | (key: string, direction: TableSortDirection) => void | - | optional |
showPagination | boolean | false | optional |
page | number | 1 | optional |
totalPages | number | 1 | optional |
onPageChange | (page: number) => void | - | optional |
mobile | boolean | false | optional |
How this component behaves at the three system breakpoints. Spacing and type tokens switch automatically at 768px and 1280px.
| Screen | Behavior |
|---|---|
| Desktop (1280px and up) | Full width of its container. Columns keep their widths; header text is truncated. |
| Tablet (768–1279px) | If the columns don't fit, the table scrolls sideways inside its container. The scroll area can be focused and scrolled with the keyboard. |
| Phone (under 768px) | Scrolls sideways inside its container. Show the most important columns first. Set mobile to stack the header area (title, search and actions). |