MDK Logo

Alerts

Alerts views and bell button — current alerts, historical log, and header alarm indicator

@tetherto/mdk-react-devkit/foundation

Alerts components cover the full alarm surface: AlarmsBellButton in the app header, the Alerts feature composite (current + historical tabs), and the standalone HistoricalAlerts table. Pair with the dashboard for live context.

Prerequisites

Components

ComponentDescription
HistoricalAlertsHistorical alerts log with date-range picker and data table
AlarmsBellButtonTop-bar bell button with three-line severity alarm badge
AlertsCurrent and historical alerts log view

HistoricalAlerts

Renders the historical alerts log as a sortable data table, with a date-range picker in the title row for adjusting the query window. Shares filter state with the current alerts view.

Import

import { HistoricalAlerts } from '@tetherto/mdk-react-devkit/foundation'
import type { HistoricalAlertsProps, HistoricalAlertsRange } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
alertsOptionalAlert[][]Pre-fetched historical alert entries
isLoadingOptionalbooleanfalseShow table loading state
localFiltersRequiredAlertLocalFiltersnoneFilters and search state shared with CurrentAlerts
filterTagsRequiredstring[]noneActive filter tags
dateRangeRequiredHistoricalAlertsRangenoneControlled start/end timestamps (ms)
onDateRangeChangeRequiredfunctionnoneFires when the user picks a new range
onAlertClickOptionalfunctionnoneRow click handler
classNameOptionalstringnoneAdditional CSS class

HistoricalAlertsRange type

type HistoricalAlertsRange = {
  start: number
  end: number
}

Basic usage

<HistoricalAlerts
  alerts={historicalAlerts}
  localFilters={localFilters}
  filterTags={filterTags}
  dateRange={{ start: rangeStart, end: rangeEnd }}
  onDateRangeChange={({ start, end }) => setRange({ start, end })}
  onAlertClick={(id, uuid) => console.log('Alert clicked', id, uuid)}
/>

Loading state

<HistoricalAlerts
  alerts={[]}
  isLoading
  localFilters={localFilters}
  filterTags={filterTags}
  dateRange={dateRange}
  onDateRangeChange={onDateRangeChange}
/>

Behaviour notes

  • The component wires a DateRangePicker into the table title via AlertsTableTitle, so date range changes come back through onDateRangeChange.
  • Rows are sorted by severity (descending) then creation date (descending) by default.
  • Timestamps are formatted through useTimezoneFormatter()'s getFormattedDate.

Next steps

On this page