MDK Logo

Dashboard

Dashboard layouts and container components

Components for building dashboard layouts and containers.

Prerequisites

  • Complete the installation

  • Add the dependency to your app's package.json
{
  "dependencies": {
    "@tetherto/mdk-react-devkit": "*",
    "@tetherto/mdk-react-adapter": "*",
    "@tetherto/mdk-ui-foundation": "*"
  }
}

Run npm install from the mdk/ui workspace root after your app is under apps/ so npm links workspace packages.

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

Components

@tetherto/mdk-react-devkit

Import the public APIs on this page from @tetherto/mdk-react-devkit.

AlarmsBellButton

Top-bar bell button with a three-line severity badge (critical / high / medium). Counts are caller-provided so the button stays domain-agnostic; pair with useActiveIncidents or useSiteMinerCounts to wire them.

onClick fires for the bell itself; pass onSeverityClick to make each count its own button (severity-filtered deep-link). The two are independent — clicking a severity does not also fire onClick

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-actions/alarms-bell-button.tsx

Props

PropStatusType / OptionsDefaultDescription
classNameOptionalstring-Additional class names
countsOptionalAlarmsBellButtonCounts{}Severity-bucketed alarm counts rendered in the stacked badge
labelOptionalstring"Active alarms"Accessible label. Defaults to "Active alarms"
onClickOptional((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)-Click handler — typically opens an alerts panel or routes to /alerts
onSeverityClickOptional((severity: AlarmSeverity, event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)-Click handler for an individual severity count. When provided, each badge row becomes its own button so an operator can jump straight to the alerts page filtered by that severity (e.g. /alerts?severity=critical). When omitted, the counts render as plain (non-interactive) text

DashboardDateRangePicker

Dashboard-friendly wrapper around the core DateRangePicker that speaks { start, end } epoch-millisecond timestamps instead of Date objects, so it drops straight into useDashboardDateRange from @tetherto/mdk-react-adapter

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/dashboard/dashboard-date-range-picker/dashboard-date-range-picker.tsx

Props

PropStatusType / OptionsDefaultDescription
onChangeRequired(next: DashboardDateRange) => void-Fires with the next { start, end } window when the user applies a range
valueRequiredDashboardDateRange-Current range as { start, end } epoch-millisecond timestamps
classNameOptionalstring-Optional class hook
dateFormatOptionalstring"dd/MM/yyyy"Display format. Defaults to dd/MM/yyyy
disabledOptionalbooleanfalseDisable the trigger

ExportButton

Split-button trigger for downloading the current dashboard state. The left half labels the action (↓ Export); the right half opens a dropdown with the available formats and invokes onExport(format) on selection

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/dashboard/export-button/export-button.tsx

Props

PropStatusType / OptionsDefaultDescription
onExportRequired(format: ExportFormat) => void-Fires with the chosen format when the user picks an item
classNameOptionalstring-Optional class hook on the wrapper
disabledOptionalbooleanfalseDisable the button
formatsOptionalreadonly ExportFormat[]['csv', 'json']Formats to offer in the dropdown — defaults to ['csv', 'json']
labelOptionalstring"Export"Button label — defaults to 'Export'

HeaderConsumptionBox

Single-row consumption cell for the dashboard's header strip. The 1.663 style numeric is rendered in orange (the warning token) to match the reference app's visual treatment

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-stats/header-consumption-box.tsx

Props

PropStatusType / OptionsDefaultDescription
classNameOptionalstring-Additional class names
iconOptionalReact.ReactNode-Icon shown next to the stat
unitOptionalstringMWUnit label — defaults to MW
valueMwOptionalnumber-Current site-level power consumption, in megawatts

HeaderEfficiencyBox

Single-row efficiency cell for the dashboard's header strip. Displays the W/TH/s metric derived from power_w / hashrate_th

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-stats/header-efficiency-box.tsx

Props

PropStatusType / OptionsDefaultDescription
classNameOptionalstring-Additional class names
iconOptionalReact.ReactNode-Icon shown next to the stat
unitOptionalstringW/TH/SUnit label — defaults to W/TH/S
valueWthSOptionalnumber-Efficiency in watts per TH/s

HeaderHashrateBox

Two-row hashrate cell for the dashboard's header strip. Shows the app-side and pool-side aggregate hashrate side by side. Values fall back to — when undefined

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-stats/header-hashrate-box.tsx

Props

PropStatusType / OptionsDefaultDescription
appLabelOptionalstringWEBAPP_SHORT_NAME ("APP")Label for the app-side row
appPhsOptionalnumber-App-side aggregate hashrate in PH/s
classNameOptionalstring-Additional class names
fractionDigitsOptionalnumber3Decimal places shown for both values — defaults to 3
iconOptionalReact.ReactNode-Icon shown next to the stat
poolPhsOptionalnumber-Pool-side aggregate hashrate in PH/s
unitOptionalstringPH/sHashrate unit label — defaults to PH/s

HeaderMinersBox

Two-row miner-count cell for the dashboard's header strip. Top row carries the app-side online / error / offline breakdown; the bottom row shows the pool-side equivalent. Numbers fall back to — when undefined

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-stats/header-miners-box.tsx

Props

PropStatusType / OptionsDefaultDescription
appLabelOptionalstringWEBAPP_SHORT_NAME ("APP")Label for the app-side row
appTotalOptionalnumber-Optional app-side meta line — total miners reporting to the app
classNameOptionalstring-Additional class names
errorOptionalnumber-Miners flagged in warning (the small amber count)
iconOptionalReact.ReactNode-Icon shown next to the "Miners" label. Caller-provided so the package stays icon-agnostic
offlineOptionalnumber-Miners offline (the small red count)
onlineOptionalnumber-Online miners (the 158 numerator)
poolMismatchOptionalnumber-Optional pool-side mismatch count (red)
poolOnlineOptionalnumber-Optional pool-side online count (green)
poolTotalOptionalnumber-Optional pool-side meta — total miners as reported by upstream pools
totalOptionalnumber-Total miners across the site (denominator of the 158 / 2,188 ratio)

HeaderStatsBar

Horizontal flex strip that hosts the dashboard's stat boxes (HeaderMinersBox, HeaderHashrateBox, HeaderConsumptionBox, HeaderEfficiencyBox). Lives inside <AppHeader> as the middle slot.

Slot-based: the caller decides which boxes to render and in which order. The bar interleaves an angled chevron divider between adjacent children to match the reference app visual treatment

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-stats/header-stats-bar.tsx

Props

PropStatusType / OptionsDefaultDescription
childrenRequiredReact.ReactNode-Stat boxes to render in order, left-to-right
classNameOptionalstring-Optional class hook

ProfileMenu

Top-bar profile dropdown. Wraps the core DropdownMenu primitive with the user-avatar icon as the trigger. Items are caller-provided so the menu surface stays application-driven

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/header-actions/profile-menu.tsx

Props

PropStatusType / OptionsDefaultDescription
itemsRequiredProfileMenuItem[]-Items rendered in the dropdown, top-to-bottom
classNameOptionalstring-Additional class names
iconOptionalReact.ReactNode<UserAvatarIcon />Override the trigger icon — defaults to the user-avatar icon
labelOptionalstring"Profile menu"Accessible label for the trigger button
userOptionalReact.ReactNode-Optional user label rendered at the top of the dropdown (e.g. an email)

SiteStatsBar

Site-level summary strip composed from WidgetTopRow (title + power) and GenericDataBox (hashrate / miner-count / container-count). Designed to sit at the top of a dashboard page above the chart cards

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/dashboard/site-stats-bar/site-stats-bar.tsx

Props

PropStatusType / OptionsDefaultDescription
titleRequiredstring-Site label rendered in the header row
classNameOptionalstring-Optional class hook
containerCountOptionalnumber-Total container count across the site
hashrateUnitOptionalstring"TH/s"Hashrate display unit — defaults to TH/s
isLoadingOptionalbooleanfalseRender a skeleton bar while data is loading
minerCountOptionalnumber-Total miner count across the site
powerOptionalnumber-Current site-level power consumption, in watts (or whatever powerUnit says)
powerUnitOptionalstring"kW"Display unit for power — defaults to kW
totalHashrateOptionalnumber-Aggregate hashrate, in TH/s

TimelineSelector

Dropdown for picking the dashboard time range. Wraps core/Select and the canonical option list from getTimelineOptions. Pair with the useDashboardTimeRange hook in @tetherto/mdk-react-adapter

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/dashboard/timeline-selector/timeline-selector.tsx

Props

PropStatusType / OptionsDefaultDescription
onChangeRequired(next: string) => void-Called whenever the user picks a new option
valueRequiredstring-Currently selected timeline value (e.g. '1m', '5m')
classNameOptionalstring-Tailwind/BEM class hook on the trigger
labelOptionalstring"Time range"ARIA label / placeholder for the trigger
optionsOptionalTimelineOption[]getTimelineOptions()Available options — defaults to getTimelineOptions. Pass a custom list to localise labels or restrict the range

On this page