Skip to main content

Entity Table

A composable table component for displaying tabular data. Uses compound components (EntityTable.Header, EntityTable.Toolbar, EntityTable.Empty, EntityTable.Error, EntityTable.Pagination) for flexible layouts. Supports sorting, searching, row selection, bulk actions, column visibility, stagger animations, glass effect styling (type/invert), row density (gap), and both load-more and page-based pagination. Two loading variants: skeleton or blurred overlay. Flexible ID handling with keyExtractor prop. No tanstack/react-table dependency.

Installation

$ npx shadcn@latest add @orecus/entity-table
Dependencies:
motionlucide-react
Registry:
@orecus/header@orecus/enhanced-empty-state@orecus/enhanced-button@orecus/use-reduced-motion@orecus/loading-overlay@orecus/color-utilscheckboxdropdown-menutooltipskeletoninputpopover

Component

Team Members

Manage your team members and their roles. Search and column visibility are integrated in the header.
Actions
Alice Johnsonalice@example.comadmin
active
1/15/2024
Bob Smithbob@example.comeditor
active
2/20/2024
Carol Williamscarol@example.comviewer
pending
3/10/2024
David Browndavid@example.comeditor
inactive
4/5/2024
Eva Martinezeva@example.comadmin
active
5/12/2024
Frank Garciafrank@example.comviewer
active
6/18/2024
Grace Leegrace@example.comeditor
pending
7/22/2024
Henry Wilsonhenry@example.comviewer
active
8/30/2024

Props

PropTypeDefaultDescription
data*T[] | undefined—Array of entities to display (extends BaseEntity). If undefined, automatically triggers loading state.
columns*EntityTableColumn<T>[]—Column definitions with key, header, sortable, cell renderer, etc.
keyExtractor(item: T, index: number) => string | number—Function to extract unique key from entity. Default: tries _id, id, key, then falls back to index
children*ReactNode—Compound components: EntityTable.Header, EntityTable.Toolbar, EntityTable.Empty, EntityTable.Pagination
actionsEntityTableRowAction<T>[]—Row actions with icon, label, onClick handler
selectionbooleanfalseEnable row selection with checkboxes
bulkActionsEntityTableBulkAction<T>[]—Actions for selected rows (requires selection=true)
defaultSort{ key: string; direction: 'asc' | 'desc' }—Default sort state for uncontrolled sorting
type'normal' | 'subtle' | 'strong' | 'solid' | 'none''normal'Glass effect variant for table styling
invertbooleanfalseInvert glass overlay (light on light, dark on dark)
gap'compact' | 'comfortable' | 'relaxed''comfortable'Row padding density (compact for dense data, relaxed for readability)
stagger'none' | 'fade' | 'slide' | 'scale''none'Stagger animation preset for row entrance. 'slide' slides down when adding, slides up when removing
staggerDelaynumber0.03Delay between staggered row animations in seconds
loadingbooleanfalseShows loading state when true
loadingVariant'skeleton' | 'overlay''skeleton'Loading display: skeleton rows or blurred overlay with spinner
loadingCountnumber5Number of skeleton rows to show when loading
errorError | null—Error object if data fetching failed
classNamestring—Additional CSS classes for the container

Compound Components

EntityTable.Header

The header section of the table.

PropTypeDefaultDescription
titlestring—The title text
showSearchboolean—Show integrated search input
showColumnVisibilityboolean—Show column visibility toggle

EntityTable.Toolbar

A separate toolbar for search and filters.

PropTypeDefaultDescription
showSearchboolean—Show search input
filtersReactNode—Custom filter elements

EntityTable.Pagination

Pagination controls.

PropTypeDefaultDescription
variant'pages' | 'load-more'—Pagination variant
pageSizenumber—Items per page
pagenumber—Current page number
totalPagesnumber—Total number of pages

EntityTable.Empty

The empty state display. Extends EnhancedEmptyState props.

PropTypeDefaultDescription
titlestring—Title text for the empty state
descriptionstring—Description text
iconLucideIcon—Icon to display
actionReactNode—Action button or element
classNamestring—Additional CSS classes

EntityTable.Error

The error state display. Shows default error UI or custom content.

PropTypeDefaultDescription
childrenReactNode—Custom error content (overrides default)

EntityTable.Stats

A section for displaying statistics between header and table.

PropTypeDefaultDescription
children*ReactNode—Stat card components to render
classNamestring—Additional CSS classes

EntityTable.Filters

A popover-based filter section.

PropTypeDefaultDescription
children*ReactNode—Filter content to render inside the popover
triggerReactNode—Custom trigger element (default: filter icon button)
openboolean—Controlled open state
onOpenChange(open: boolean) => void—Open state change handler
align'start' | 'center' | 'end''end'Popover alignment
classNamestring—Additional CSS classes for the popover content