MDK Logo
ReferenceUIComponents

Table Components

Data tables, grids, and tabular display components

Components for displaying and interacting with tabular data.

Prerequisites

  • Complete the installation

  • Import styles: import '@tetherto/mdk-react-devkit/styles.css'

Components

@tetherto/mdk-react-devkit

Data table

import { DataTable } from '@tetherto/mdk-react-devkit'

Sortable, paginated, optionally selectable / expandable table built on TanStack React Table. Controlled and uncontrolled modes for each piece of state.

Props (subset)

PropTypeRequiredDefaultDescription
dataI[]yesRows.
columnsDataTableColumnDef<I>[]yesTanStack column defs.
fullWidthbooleannotrueStretch to container width.
enableRowSelectionboolean | ((row) => boolean)nofalseCheckbox column.
enableMultiRowSelectionbooleannotrueAllow multi-select.
selectionsDataTableRowSelectionStatenoControlled row-selection state.
onSelectionsChange(s: DataTableRowSelectionState) => voidnoSetter.
enablePaginationbooleannotrueShow pagination footer.
paginationDataTablePaginationStatenoControlled pagination.
sortingDataTableSortingStatenoControlled sorting.
borderedbooleannofalseAdd cell borders.
loadingbooleannofalseShow loading overlay.
enableRowExpansionbooleannofalseShow row expansion column.
renderExpandedContent(row) => ReactNodenoRequired when row expansion is enabled.
getRowId(row, index, parent?) => stringnoindexStable row ID source.

See data-table.tsx for the full list (16 props).

Column meta

FieldApplied by DataTableDescription
alignyesleft | center | right on cells

Data contracts

DataTableColumnDef, DataTableRow, DataTableSortingState, DataTablePaginationState, DataTableRowSelectionState, DataTableExpandedState are re-exported from @tetherto/mdk-react-devkit.

Example

/**
 * Runnable example for DataTable.
 */
import type { DataTableColumnDef } from '@tetherto/mdk-react-devkit'
import { DataTable } from '@tetherto/mdk-react-devkit'

type Miner = {
  id: string
  status: 'online' | 'warning' | 'offline'
  hashrate: number
  power_w: number
}

const data: Miner[] = [
  { id: 'miner-01', status: 'online', hashrate: 102.4, power_w: 3200 },
  { id: 'miner-02', status: 'warning', hashrate: 95.1, power_w: 3450 },
  { id: 'miner-03', status: 'offline', hashrate: 0, power_w: 0 },
]

const columns: DataTableColumnDef<Miner, unknown>[] = [
  { accessorKey: 'id', header: 'Miner' },
  { accessorKey: 'status', header: 'Status' },
  { accessorKey: 'hashrate', header: 'Hashrate (TH/s)' },
  { accessorKey: 'power_w', header: 'Power (W)' },
]

export const DataTableExample = () => {
  return <DataTable<Miner> data={data} columns={columns} getRowId={(row) => row.id} />
}
@tetherto/mdk-react-devkit

AlertConfirmationModal

Modal that confirms acknowledging or clearing one or more alerts before applying the change.

agent-ready

Props

PropTypeRequiredDefaultDescription
isOpenboolean--
onOkVoidFunction--

Alerts

Full alerts page — combines the searchable current-alerts table, an optional historical-alerts log section, severity filters, and the sound confirmation modal. Wraps CurrentAlerts and HistoricalAlerts and coordinates their shared filter / date-range / selected-id state.

Must be rendered inside <MdkProvider> — the embedded tables read tag filters from the devices store and use the timezone formatter hook.

agent-ready

Props

PropTypeRequiredDefaultDescription
devicesDevice[][] | undefined-Devices payload powering the "Current Alerts" table. Mirrors the API response shape of useGetListThingsQuery({ ... alerts query }).
isCurrentAlertsLoadingboolean | undefined-Loading flag for the "Current Alerts" table.
historicalAlertsAlert[] | undefined-Pre-fetched historical alerts log entries.
isHistoricalAlertsLoadingboolean | undefined--
isHistoricalAlertsEnabledboolean | undefinedfalseWhen true, shows the "Historical Alerts Log" section. Mirrors the alertsHistoricalLogEnabled feature flag in the source app.
selectedAlertIdstring | undefined-Optional alert id used to focus on a single alert (deep-link from URL).
initialSeveritystring | undefined-Initial severity selection (typically derived from ?severity= URL param).
onAlertClick((id?: string | undefined, uuid?: string | undefined) => void) | undefined-Callback invoked when the operator clicks an alert row. Receives the device id and alert uuid.
dateRangeHistoricalAlertsRange | undefined-Controlled date range for the historical alerts. Defaults to last 14 days.
onDateRangeChange((range: HistoricalAlertsRange) => void) | undefined--
isSoundEnabledboolean | undefinedfalseWhether sound notifications are enabled in user preferences.
isDemoModeboolean | undefinedfalseWhen true, sound notifications are skipped (e.g. demo / preview).
typeFiltersForSiteCascaderOption[] | undefined-Optional site-specific overrides for the type filter.
headerReact.ReactNode-Optional header (e.g. breadcrumbs) rendered above the alerts.
classNamestring | undefined--

AlertsTableTitle

Title strip for an alerts table with the section heading and an optional count badge.

agent-ready

Props

PropTypeRequiredDefaultDescription
titleReact.ReactNode--
subtitleReact.ReactNode--
classNamestring | undefined--

CurrentAlerts

Sortable, searchable data table of currently active alerts derived from a raw devices payload. Plays an audible beep when a critical alert is present (gated by isSoundEnabled + user confirmation modal).

agent-ready

Props

PropTypeRequiredDefaultDescription
devicesDevice[][] | undefined-Raw devices (with last.alerts) used to derive current alerts from. Shape mirrors the API response from the source app.
isLoadingboolean | undefined--
localFiltersAlertLocalFilters-Filters controlled outside (typically by URL severity param).
onLocalFiltersChange(filters: AlertLocalFilters) => void--
filterTagsstring[]-Search tags (controlled). Mirrors the redux selectFilterTags slice in the source app.
onFilterTagsChange(tags: string[]) => void--
selectedAlertIdstring | undefined-Optional id used to focus on a single alert (deep-link from URL).
onAlertClick((id?: string | undefined, uuid?: string | undefined) => void) | undefined-Click handler when the user opens an alert (right arrow icon in the row).
isSoundEnabledboolean | undefinedfalseWhether sound notifications are enabled in user preferences (e.g. theme slice).
isDemoModeboolean | undefinedfalseSkip sound entirely (e.g. in demo/preview environments).
typeFiltersForSiteCascaderOption[] | undefined-Optional site-specific overrides for the type filter.
classNamestring | undefined--

DataTable

Generic typed data table built on TanStack React Table. Supports pagination, sorting, expansion, row selection and custom column renderers.

agent-ready

Props

PropTypeRequiredDefaultDescription
dataI[]-The data to be shown in the table. See https://tanstack.com/table/v8/docs/guide/data
columnsColumnDef<I, any>[]-The column configuration table. See https://tanstack.com/table/v8/docs/guide/column-defs
fullWidthboolean | undefinedtrueIs table full width
enableRowSelectionboolean | ((row: Row<I>) => boolean) | undefinedfalseShow a checkbox column and enables selection
enableMultiRowSelectionboolean | undefinedtrueEnables selection of multiple rows
selectionsRowSelectionState | undefinedundefinedSpecify the selected rows. If undefined, the selections are managed internally Object with the key of row ID and a boolean specifying if the row is selected. The default row ID is the index. This can be changed using getRowId prop
onSelectionsChange((selections: RowSelectionState) => void) | undefined-Callback to be called when the row are selected / unselected
enablePaginationboolean | undefinedtrueShow pagination
borderedboolean | undefinedfalseAdd borders to all cells
paginationPaginationState | undefinedundefinedSpecify the pagination params. Object of shape { pageIndex: number, pageSize: number }. If undefined then the pagination is managed internally.
onPaginationChange((pagination: PaginationState) => void) | undefined-Callback to be called when the pagination params change
sortingSortingState | undefinedundefinedSpecify the sorting params. If undefined then the sorting is managed internally.
defaultSortingSortingState | undefined[]Default sorting applied when the table is first mounted (uncontrolled mode). Ignored when sorting is provided.
onSortingChange((sorting: SortingState) => void) | undefined-Callback to be called when the sorting changes
wrapperClassNamestring | undefined-Classname of the wrapper element
contentClassNamestring | undefined-Classname of the content element
tableClassNamestring | undefined-Classname of the table element
loadingboolean | undefinedfalseShow a loading indicator overlay
enableRowExpansionboolean | undefinedfalseShow a columns with a button which can expand the row
canRowExpand((row: Row<I>) => boolean) | undefinedfalseCallback to check if a row can be expanded
expandedRowsExpandedState | undefined-Specify the expanded rows If undefined, the expansions are managed internally Object with the key of row ID and a boolean specifying if the row is selected. The default row ID is the index. This can be changed using getRowId prop
onExpandedRowsChange((expandedRows: ExpandedState) => void) | undefined-Callback to be called when the rows are expanded or collapsed
renderExpandedContent((row: Row<I>) => React.ReactNode) | undefined-Render the content of the expanded row. Required when enableRowExpansion is true
getRowId((row: I, index: number, parent?: Row<I> | undefined) => string) | undefined-Get the row ID for a row. If not specified index is the default row ID.
onRowClick((rowData: I) => void) | undefined-Called when a body row is clicked. When set, rows become interactive (pointer cursor, role="button", keyboard-activatable with Enter/Space). Clicks originating from an interactive control in the row (button, link, input, checkbox, or anything marked data-no-row-click) are ignored, so the selection checkbox and expand toggle keep working independently.

DeviceExplorer

Top-level device explorer: filter toolbar + searchable, sortable table of miners or cabinets. Designed to be controlled by URL state in the host app.

agent-ready

Props

PropTypeRequiredDefaultDescription
deviceTypeDeviceExplorerDeviceType--
classNamestring | undefined--
selectedDevicesRowSelectionState | undefined--
onSelectedDevicesChange((selections: RowSelectionState) => void) | undefined--
onFiltersChange(value: LocalFilters) => void--
filterOptionsDeviceExplorerFilterOption[]--
searchOptionsDeviceExplorerSearchOption[]--
searchTagsstring[]--
onSearchTagsChange(tags: string[]) => void--
onDeviceTypeChange(type: DeviceExplorerDeviceType) => void--
filtersLocalFilters | undefined--
onSortingChange((sorting: SortingState) => void) | undefined--
dataDevice[]--
getFormattedDate(date: Date) => string--
renderAction(device: Device) => React.ReactNode--
onRowClick((device: Device) => void) | undefined-Called when a row is clicked (e.g. to open the device's detail page).

EfficiencyMinerTypeView

Efficiency drilldown grouped by miner model — J/TH and uptime for each model in the fleet.

agent-ready

Props

PropTypeRequiredDefaultDescription
isLoadingboolean | undefined--
onTimeFrameChange((start: Date, end: Date) => void) | undefined--
chartInputToBarChartDataInput | undefined--
isEmptyboolean | undefined--

EfficiencyMinerUnitView

Efficiency drilldown by individual miner serial — outliers and worst-performers surface here.

agent-ready

Props

PropTypeRequiredDefaultDescription
isLoadingboolean | undefined--
onTimeFrameChange((start: Date, end: Date) => void) | undefined--
chartInputToBarChartDataInput | undefined--
isEmptyboolean | undefined--

EfficiencySiteView

Site-level efficiency view — site-aggregate J/TH, uptime, and capacity utilisation cards.

agent-ready

Props

PropTypeRequiredDefaultDescription
logMetricsEfficiencyLogEntry[] | undefined--
avgEfficiencynumber | null | undefined--
nominalValuenumber | null | undefined--
isLoadingboolean | undefined--
dateRangeEfficiencyDateRange | undefined--
onDateRangeChange((range: EfficiencyDateRange) => void) | undefined--
onResetVoidFunction | undefined--

HistoricalAlerts

Sortable data table of historical alerts within a controlled date range. Renders a header with title + DateRangePicker, then the table.

agent-ready

Props

PropTypeRequiredDefaultDescription
alertsAlert[] | undefined-Pre-fetched historical alerts log entries (each with a thing device payload).
isLoadingboolean | undefined--
localFiltersAlertLocalFilters-Filters and search tags coming from the parent (typically shared with CurrentAlerts).
filterTagsstring[]--
dateRangeHistoricalAlertsRange-Selected date range for the historical query (controlled).
onDateRangeChange(range: HistoricalAlertsRange) => void--
onAlertClick((id?: string | undefined, uuid?: string | undefined) => void) | undefined--
classNamestring | undefined--

OperationsEfficiency

Top-level operations-efficiency section of the report — composes the site/type/unit views.

agent-ready

Props

PropTypeRequiredDefaultDescription
defaultTabEfficiencyTabValue | undefined--
siteViewEfficiencySiteViewProps | undefined--
minerTypeViewEfficiencyMinerTypeViewProps | undefined--
minerUnitViewEfficiencyMinerUnitViewProps | undefined--

PoolManagerMinerExplorer

Pool-manager miner explorer page — searchable / filterable table of miners with multi-select and an "Assign Pool" bulk action. Submits the chosen pool change as a pending action via the adapter actions store, then opens a confirmation modal.

Must be rendered inside <MdkProvider> — the page uses useActions, useCheckPerm, and useContextualModal from @tetherto/mdk-react-adapter.

agent-ready

Props

PropTypeRequiredDefaultDescription
minersListThingsDevice[]-Miners to render in the explorer table.
poolConfigPoolConfigEntry[]-Pool configurations powering the "Assign Pool" dropdown.
backButtonClickVoidFunction-Called when the operator clicks the "Pool Manager" back link.

PoolManagerPools

Pool-manager pools page — accordion list of every configured pool with header summary (name, status, priority) and an expandable body (per-pool stats, edit, delete). Optional "Add Pool" CTA is gated by the ADD_POOL_ENABLED feature flag.

Must be rendered inside <MdkProvider> — the embedded "Add Pool" modal uses the contextual-modal adapter hook.

agent-ready

Props

PropTypeRequiredDefaultDescription
poolConfigPoolConfigEntry[]-Array of pool configurations to render.
backButtonClickVoidFunction-Called when the operator clicks the "Pool Manager" back link.

RepairLogChangesSubRow

Expandable sub-row that lists the spare-part changes recorded in a repair batch action. Each non-miner repair action is resolved against its device to show the part type, serial number, MAC address, and whether the part was added or removed. Device data is fetched by the parent and passed in via props — the component does no data fetching itself.

agent-ready

Props

PropTypeRequiredDefaultDescription
batchActionPartial<{ params: Partial<{ params: Partial<{ comment: string; id: string; rackId: string; info: { parentDeviceId: string | null; }; }>[]; }>[]; }>-The repair batch action whose part changes should be displayed.
devicesPartial<{ id: string; rack: string; info: Partial<{ serialNum: string; macAddress: string; }>; }>[]-Devices referenced by the batch action, pre-fetched by the parent.
isLoadingboolean | undefinedfalseShow a spinner while the parent is still fetching devices.

TagFilterBar

Horizontal strip of removable tag chips that narrow a list view; clicking a chip removes the filter.

agent-ready

Props

PropTypeRequiredDefaultDescription
filterTagsstring[]--
localFiltersAlertLocalFilters--
onSearchTagsChange(tags: string[]) => void--
onLocalFiltersChange(filters: AlertLocalFilters) => void--
typeFiltersForSiteCascaderOption[] | undefined-Site-specific overrides for the "type" filter children. If provided, the "Type" filter group will use these instead of the defaults.
placeholderstring | undefined--
classNamestring | undefined--

On this page