diff --git a/packages/demo/src/components/demo/table.tsx b/packages/demo/src/components/demo/table.tsx
index d942ac7..5f04fff 100644
--- a/packages/demo/src/components/demo/table.tsx
+++ b/packages/demo/src/components/demo/table.tsx
@@ -1,5 +1,11 @@
-import { Button, SortButton, Table, Badge } from "@eqtylab/equality";
import type { Elevation } from "@eqtylab/equality";
+import {
+ Badge,
+ Button,
+ EmptyTableState,
+ SortButton,
+ Table,
+} from "@eqtylab/equality";
interface TableDemoProps {
variant?:
@@ -7,7 +13,9 @@ interface TableDemoProps {
| "clickable"
| "with-actions"
| "with-border"
- | "with-sorter";
+ | "with-sorter"
+ | "empty-state"
+ | "empty-state-custom";
elevation: Elevation;
}
@@ -187,6 +195,38 @@ export const TableDemo = ({
);
}
+ if (variant === "empty-state") {
+ return (
+
+ );
+ }
+
+ if (variant === "empty-state-custom") {
+ return (
+ {}}
+ />
+ }
+ />
+ );
+ }
+
if (variant === "with-sorter") {
const columns_with_sorter = [
{
diff --git a/packages/demo/src/content/components/table.mdx b/packages/demo/src/content/components/table.mdx
index e6a7d03..3088fc1 100644
--- a/packages/demo/src/content/components/table.mdx
+++ b/packages/demo/src/content/components/table.mdx
@@ -25,6 +25,18 @@ import { ELEVATION } from "@eqtylab/equality";
+### Empty State
+
+When `rows` is empty and `emptyState` is provided, the table keeps column headers visible and renders the empty state content spanning all columns.
+
+
+
+### Empty State with Custom Component
+
+The `emptyState` prop accepts any `ReactNode`, so you can pass a custom component like `EmptyTableState`.
+
+
+
## Style Options
### With Border
@@ -94,3 +106,13 @@ import { ELEVATION } from "@eqtylab/equality";
variant="with-border"
elevation={ELEVATION.FLOATING}
/>
+
+## Props
+
+| Name | Description | Type | Default | Required |
+| ------------ | ------------------------------------------------------------ | ------------------------------------------------- | ------- | -------- |
+| `columns` | Column definitions with key, content, and optional className | `TableColumn[]` | | ✅ |
+| `rows` | Row data with key, cells, and optional onClick/className | `TableRowData[]` | | ✅ |
+| `border` | Adds a border and rounded corners around the table | `boolean` | `false` | ❌ |
+| `elevation` | Controls the shadow and border elevation level | `sunken`, `base`, `raised`, `overlay`, `floating` | `base` | ❌ |
+| `emptyState` | Content rendered when rows is empty, spanning all columns | `ReactNode` | | ❌ |
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 51db95f..27b2b4f 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -2,7 +2,7 @@
"name": "@eqtylab/equality",
"description": "EQTYLab's component and token-based design system",
"homepage": "https://equality.eqtylab.io/",
- "version": "1.2.0",
+ "version": "1.2.1",
"license": "Apache-2.0",
"keywords": [
"component library",
diff --git a/packages/ui/src/components/table/table.module.css b/packages/ui/src/components/table/table.module.css
index b58d1b9..e600bf5 100644
--- a/packages/ui/src/components/table/table.module.css
+++ b/packages/ui/src/components/table/table.module.css
@@ -17,6 +17,10 @@
@apply overflow-hidden rounded-md;
}
+.table-empty-state {
+ @apply text-text-secondary py-8 text-center;
+}
+
/* ELEVATION */
.table--sunken {
diff --git a/packages/ui/src/components/table/table.tsx b/packages/ui/src/components/table/table.tsx
index 668676a..58fd486 100644
--- a/packages/ui/src/components/table/table.tsx
+++ b/packages/ui/src/components/table/table.tsx
@@ -38,6 +38,7 @@ interface TableProps extends VariantProps {
rows: TableRowData[];
className?: string;
border?: boolean;
+ emptyState?: React.ReactNode;
}
const tableElevationVariants = generateElevationVariants(styles, 'table', ELEVATION.BASE);
@@ -48,7 +49,10 @@ const Table = ({
className,
border = false,
elevation = ELEVATION.BASE,
+ emptyState,
}: TableProps) => {
+ const isEmpty = rows.length === 0;
+
return (
-
- {rows.map((row) => (
-
- {row.cells.map((cell) => (
-
- {cell.content}
-
- ))}
+ {isEmpty && emptyState ? (
+
+
+
+ {emptyState}
+
- ))}
-
+
+ ) : (
+
+ {rows.map((row) => (
+
+ {row.cells.map((cell) => (
+
+ {cell.content}
+
+ ))}
+
+ ))}
+
+ )}
);