Data Displayduskmoonimplemented7 demos

Table

Table renders structured data with columns, sorting, filters, selection, and pagination.

Import@duskmoon-dev/components/table
23API sections
93documented props
5behavior scenarios
Key API
columnsdataSourcerowKeyloadingborderedsize

Usage

When to use

  • Use it when users need to scan structured content and act on individual records.
  • Prefer it over ad hoc markup when the content has repeatable fields, hierarchy, or navigation state.

Implementation notes

StylesheetImport @duskmoon-dev/components/styles.css once in the app or docs shell.
StateStart with default props for static examples, then switch to controlled props when state must be shared.
ThemeThe preview inherits the active DuskMoon data-theme value from the docs layout.

Features

Structured records

Designed for repeated or hierarchical content where users scan, compare, and inspect details.

Stateful interactions

Documents the props that control sorting, selection, expansion, pagination, or value changes where available.

Primary API surface

Table is most often configured through `columns`, `dataSource`, `rowKey`, `loading`.

Covered behavior

Renders columns, dataSource, nested dataIndex, loading, and empty text

Feature Demos

Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.

Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Basic usage

authored

Import the component stylesheet and Table from its package subpath, then render it with the core props.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function Example() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Renders columns, dataSource, nested dataIndex, loading, and empty text

test-backed

Table scenario from the component test coverage: renders columns, datasource, nested dataindex, loading, and empty text.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function TableRendersColumnsDataSourceNestedDemo() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Sorts data and emits onChange sorter information

test-backed

Table scenario from the component test coverage: sorts data and emits onchange sorter information.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function TableSortsDataAndEmitsDemo() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Filters rows and emits filter changes

test-backed

Table scenario from the component test coverage: filters rows and emits filter changes.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function TableFiltersRowsAndEmitsDemo() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Supports row selection and expandable rows

test-backed

Table scenario from the component test coverage: supports row selection and expandable rows.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function TableSupportsRowSelectionAndDemo() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Supports pagination config, summary, Column, and ColumnGroup

test-backed

Table scenario from the component test coverage: supports pagination config, summary, column, and columngroup.

Source
import "@duskmoon-dev/components/styles.css";
import { Table } from "@duskmoon-dev/components/table";

export function TableSupportsPaginationConfigSummaryDemo() {
  return (<Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>);
}
Preview
Sunshine Theme
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai
Moonlight Theme
NameStatusOwner
Design tokensReadyLuna
ComponentsReviewKai

Theme aware

authored

Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.

Source
<div data-theme="sunshine">
  <Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>
</div>

<div data-theme="moonlight">
  <Table
  columns={[
    { title: "Name", dataIndex: "name", key: "name" },
    { title: "Status", dataIndex: "status", key: "status" },
    { title: "Owner", dataIndex: "owner", key: "owner" }
  ]}
  dataSource={[
    { key: 1, name: "Design tokens", status: "Ready", owner: "Luna" },
    { key: 2, name: "Components", status: "Review", owner: "Kai" }
  ]}
  pagination={false}
  bordered
/>
</div>

API

The API reference below lists every parsed exported type or interface for Table. Start with `columns`, `dataSource`, `rowKey`, `loading` for common usage.

Types: packages/components/src/components/table/Table.types.tsScenarios: packages/components/src/components/table/Table.test.tsx
TablePropsinterface extends <T = TableRecord> extends Omit< ComponentProps<"div">, "onChange" >
PropTypeRequiredDescription
columnsTableColumnsType<T>Nocolumns configures Table.
dataSourceT[]NodataSource configures Table.
rowKeyTableRowKey<T>NorowKey configures Table.
loadingboolean | { spinning?: boolean; indicator?: ReactNode }Noloading configures Table.
borderedbooleanNobordered configures Table.
sizeTableSizeNosize configures Table.
paginationfalse | TablePaginationConfigNopagination configures Table.
rowSelectionTableRowSelection<T>NorowSelection configures Table.
expandableTableExpandableConfig<T>Noexpandable configures Table.
summary(pageData: readonly T[]) => ReactNodeNosummary configures Table.
localeTableLocaleNolocale configures Table.
tableLayoutCSSProperties["tableLayout"]NotableLayout configures Table.
scroll{ x?: number | string | true; y?: number | string }Noscroll configures Table.
onChange(NoonChange configures Table.
paginationTablePaginationConfig,Yespagination configures Table.
filtersRecord<string, FilterValue | null>,Yesfilters configures Table.
sorterSorterResult<T>,Yessorter configures Table.
extraTableCurrentDataSource<T>,Yesextra configures Table.
TableColumnTypeinterface extends <T = TableRecord>
PropTypeRequiredDescription
titleReactNodeNotitle configures Table.
dataIndexDataIndexNodataIndex configures Table.
keyTableKeyNokey configures Table.
widthstring | numberNowidth configures Table.
align"left" | "center" | "right"Noalign configures Table.
classNamestringNoclassName configures Table.
fixed"left" | "right" | booleanNofixed configures Table.
ellipsisbooleanNoellipsis configures Table.
render(value: unknown, record: T, index: number) => ReactNodeNorender configures Table.
sorterTableSorter<T>Nosorter configures Table.
sortOrderSortOrderNosortOrder configures Table.
defaultSortOrderSortOrderNodefaultSortOrder configures Table.
sortDirectionsSortOrder[]NosortDirections configures Table.
filtersTableFilterItem[]Nofilters configures Table.
filteredValueFilterValue | nullNofilteredValue configures Table.
defaultFilteredValueFilterValue | nullNodefaultFilteredValue configures Table.
filterMultiplebooleanNofilterMultiple configures Table.
onFilter(value: string | number | boolean | null, record: T) => booleanNoonFilter configures Table.
childrenTableColumnsType<T>Nochildren configures Table.
onCell(record: T, index: number) => ComponentProps<"td">NoonCell configures Table.
onHeaderCell(column: TableColumnType<T>) => ComponentProps<"th">NoonHeaderCell configures Table.
TablePaginationConfiginterface
PropTypeRequiredDescription
currentnumberNocurrent configures Table.
defaultCurrentnumberNodefaultCurrent configures Table.
pageSizenumberNopageSize configures Table.
defaultPageSizenumberNodefaultPageSize configures Table.
totalnumberNototal configures Table.
disabledbooleanNodisabled configures Table.
hideOnSinglePagebooleanNohideOnSinglePage configures Table.
showTotal(total: number, range: [number, number]) => ReactNodeNoshowTotal configures Table.
onChange(page: number, pageSize: number) => voidNoonChange configures Table.
TableFilterIteminterface
PropTypeRequiredDescription
textReactNodeYestext configures Table.
valuestring | number | booleanYesvalue configures Table.
childrenTableFilterItem[]Nochildren configures Table.
TableColumnGroupTypeinterface extends <T = TableRecord> extends Omit< TableColumnType<T>, "dataIndex" | "render" | "sorter" | "filters" >
PropTypeRequiredDescription
childrenTableColumnsType<T>Yeschildren configures Table.
SorterResultinterface extends <T = TableRecord>
PropTypeRequiredDescription
columnTableColumnType<T>Nocolumn configures Table.
columnKeyTableKeyNocolumnKey configures Table.
fieldDataIndexNofield configures Table.
orderSortOrderNoorder configures Table.
TableCurrentDataSourceinterface extends <T = TableRecord>
PropTypeRequiredDescription
currentDataSourceT[]YescurrentDataSource configures Table.
action"paginate" | "sort" | "filter"Yesaction configures Table.
TableRowSelectioninterface extends <T = TableRecord>
PropTypeRequiredDescription
type"checkbox" | "radio"Notype configures Table.
selectedRowKeysTableKey[]NoselectedRowKeys configures Table.
defaultSelectedRowKeysTableKey[]NodefaultSelectedRowKeys configures Table.
hideSelectAllbooleanNohideSelectAll configures Table.
columnTitleReactNodeNocolumnTitle configures Table.
getCheckboxProps(record: T) => ComponentProps<"input">NogetCheckboxProps configures Table.
renderCell(NorenderCell configures Table.
checkedboolean,Yeschecked configures Table.
recordT,Yesrecord configures Table.
indexnumber,Yesindex configures Table.
originNodeReactNode,YesoriginNode configures Table.
onChange(selectedRowKeys: TableKey[], selectedRows: T[]) => voidNoonChange configures Table.
onSelect(NoonSelect configures Table.
recordT,Yesrecord configures Table.
selectedboolean,Yesselected configures Table.
selectedRowsT[],YesselectedRows configures Table.
nativeEventEvent,YesnativeEvent configures Table.
onSelectAll(NoonSelectAll configures Table.
selectedboolean,Yesselected configures Table.
selectedRowsT[],YesselectedRows configures Table.
changedRowsT[],YeschangedRows configures Table.
TableExpandableConfiginterface extends <T = TableRecord>
PropTypeRequiredDescription
expandedRowKeysTableKey[]NoexpandedRowKeys configures Table.
defaultExpandedRowKeysTableKey[]NodefaultExpandedRowKeys configures Table.
expandedRowRender(NoexpandedRowRender configures Table.
recordT,Yesrecord configures Table.
indexnumber,Yesindex configures Table.
indentnumber,Yesindent configures Table.
expandedboolean,Yesexpanded configures Table.
rowExpandable(record: T) => booleanNorowExpandable configures Table.
expandRowByClickbooleanNoexpandRowByClick configures Table.
columnTitleReactNodeNocolumnTitle configures Table.
onExpand(expanded: boolean, record: T) => voidNoonExpand configures Table.
onExpandedRowsChange(expandedKeys: TableKey[]) => voidNoonExpandedRowsChange configures Table.
TableLocaleinterface
PropTypeRequiredDescription
emptyTextReactNodeNoemptyText configures Table.
TableSummaryPropsinterface extends ComponentProps<"tfoot">
PropTypeRequiredDescription
fixedboolean | "top" | "bottom"Nofixed configures Table.
TableKeytype
string | number
TableRecordtype
Record<string, unknown>
DataIndextype
string | number | readonly (string | number)[]
SortOrdertype
"ascend" | "descend" | null
FilterValuetype
Array<string | number | boolean | null>
TableSizetype
"small" | "middle" | "large"
TableSummaryRowPropstype
ComponentProps<"tr">
TableSummaryCellPropstype
ComponentProps<"td"> & { index?: number
TableColumnComponenttype
ForwardRefExoticComponent< TableColumnProps & RefAttributes<HTMLTableCellElement> >
TableColumnGroupComponenttype
ForwardRefExoticComponent< TableColumnGroupProps & RefAttributes<HTMLTableCellElement> >
TableSummaryComponenttype
ForwardRefExoticComponent< TableSummaryProps & RefAttributes<HTMLTableSectionElement> > & { Row: ForwardRefExoticComponent< TableSummaryRowProps & RefAttributes<HTMLTableRowElement> >
TableComponenttype
(<T = TableRecord>( props: TableProps<T> & RefAttributes<HTMLDivElement>, ) => ReactElement | null) & { Column: TableColumnComponent