Anomaly Feed

1 variant

An alerts feed that flags metrics drifting from forecast, with band charts, snooze and resolve, and an investigate dialog.

Anomaly alerts

Metrics that drift from forecast, each with a mini band chart that draws in and pulses where the line leaves the band. Snooze and resolve with undo, open an investigate dialog with a larger chart and likely causes, and watch new anomalies arrive at the top.

Anomalies3

  • Critical
    SignupsUSMobile12m ago
  • Warning
    Checkout latencyEUWeb38m ago
  • Info
    Organic sessionsSearchBlog2h ago

3 open · 1 critical · last checked 1m ago

"use client";

import { AnomalyFeed } from "@/components/premium/anomaly-feed";

export function AnomalyFeedAlertsPreview() {
  return (
    <div className="w-full px-4 py-10">
      <AnomalyFeed />
    </div>
  );
}

Install

$ bunx --bun shadcn add @beui-pro/anomaly-feed-alerts

API Reference

Every prop is optional unless marked required. Data, copy, and colors default to the sample content.

AnomalyFeed21 props
  • anomalies

    Anomalies to start with, newest first. Pass a stable (memoized) array.

    Anomaly[]
  • liveAnomaly

    Anomaly that arrives at the top during the live demo.

    Anomaly
  • live

    Run the live demo: one new anomaly arrives a few seconds after the card is visible.

    boolean

    Default true

  • liveDelayMs

    Wait before the live anomaly arrives, in ms.

    number

    Default 4000

  • status

    Selected tab (controlled).

    "open" | "snoozed" | "resolved"
  • defaultStatus

    Selected tab when uncontrolled.

    "open" | "snoozed" | "resolved"

    Default open

  • onStatusChange

    Called when a tab is chosen.

    ((status: AnomalyStatus) => void)
  • snoozeOptions

    Snooze lengths offered in the row menu.

    AnomalySnooze[]

    Default ["1h", "1d", "1w"]

  • severityStyles

    Colors for each severity; any left out keeps its default.

    Partial<Record<AnomalySeverity, AnomalySeverityStyle>>
  • lastCheckedMinutes

    Minutes since the last check, shown in the footer until a new anomaly arrives.

    number

    Default 1

  • undoMs

    How long the undo chip stays after an action, in ms.

    number

    Default 4000

  • formatAge

    Formats minutes since detection, such as "12m ago".

    ((minutes: number) => string)
  • formatValue

    Formats chart values with the anomaly's unit.

    ((value: number, anomaly: Anomaly) => string)
  • formatPercent

    Formats a signed deviation, given as a share of expected.

    ((share: number) => string)
  • formatFooter

    Builds the footer line from the open and critical counts.

    ((info: AnomalyFooterInfo) => string)
  • onSnooze

    Called when an anomaly is snoozed, with the chosen length.

    ((anomaly: Anomaly, duration: AnomalySnooze) => void)
  • onResolve

    Called when an anomaly is resolved from its row or the dialog.

    ((anomaly: Anomaly) => void)
  • onReopen

    Called when a snoozed or resolved anomaly is reopened.

    ((anomaly: Anomaly) => void)
  • onInvestigate

    Called when the investigate dialog opens for an anomaly.

    ((anomaly: Anomaly) => void)
  • labels

    Copy overrides; anything left out uses the English defaults.

    Partial<AnomalyFeedLabels>
  • className

    Classes for the card.

    string
AnomalyCauses4 props
  • causesRequired

    Causes to list, most likely first.

    AnomalyCause[]
  • headingRequired

    Heading over the list.

    string
  • emptyRequired

    Line shown when there are no causes.

    string
  • reduceRequired

    Skip movement, keep fades.

    boolean
AnomalyEmptyIllustration3 props
  • statusRequired

    Tab the empty state belongs to, which picks the badge glyph.

    "open" | "snoozed" | "resolved"
  • accentClassName

    Accent class for the badge, such as `text-emerald-500`.

    string

    Default text-emerald-500

  • className

    Extra classes for the svg.

    string
AnomalyList12 props
  • itemsRequired

    Anomalies in the selected tab, newest first.

    Anomaly[]
  • statusRequired

    Selected tab, which picks the empty state.

    "open" | "snoozed" | "resolved"
  • severityStylesRequired

    Colors for each severity.

    Record<AnomalySeverity, AnomalySeverityStyle>
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • canHoverRequired

    Hover-capable pointer: actions reveal on hover.

    boolean
  • snoozeOptionsRequired

    Snooze lengths offered in the menu.

    AnomalySnooze[]
  • labelsRequired

    Copy for rows and empty states.

    AnomalyFeedLabels
  • formatAgeRequired

    Formats minutes since detection.

    (minutes: number) => string
  • onSnoozeRequired

    Called with an anomaly and the chosen snooze length.

    (anomaly: Anomaly, duration: AnomalySnooze) => void
  • onResolveRequired

    Called when an anomaly is resolved.

    (anomaly: Anomaly) => void
  • onReopenRequired

    Called when a snoozed or resolved anomaly is reopened.

    (anomaly: Anomaly) => void
  • onInvestigateRequired

    Called when an anomaly is opened for investigation.

    (anomaly: Anomaly) => void
AnomalyMiniChart6 props
  • anomalyRequired

    Anomaly whose buckets to draw.

    Anomaly
  • styleRequired

    Colors for the anomaly's severity.

    AnomalySeverityStyle
  • pulseRequired

    Pulse the anomaly marker while visible.

    boolean
  • delayRequired

    Seconds before the actual line starts drawing.

    number
  • labelRequired

    Accessible summary of the chart.

    string
  • className

    Classes for the chart box.

    string
AnomalyRow13 props
  • anomalyRequired

    The anomaly to draw.

    Anomaly
  • styleRequired

    Colors for the anomaly's severity.

    AnomalySeverityStyle
  • delayRequired

    Entrance delay in seconds; 0 for rows that join after the list opens.

    number
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • canHoverRequired

    Hover-capable pointer: actions reveal on hover; otherwise they always show.

    boolean
  • snoozeOptionsRequired

    Snooze lengths offered in the menu.

    AnomalySnooze[]
  • labelsRequired

    Copy for actions and the severity name.

    AnomalyFeedLabels
  • formatAgeRequired

    Formats minutes since detection.

    (minutes: number) => string
  • onSnoozeRequired

    Called with the chosen snooze length.

    (duration: AnomalySnooze) => void
  • onResolveRequired

    Called when Resolve is pressed.

    () => void
  • onReopenRequired

    Called when Reopen is pressed.

    () => void
  • onInvestigateRequired

    Called when the row or Investigate is pressed.

    () => void
  • ref

    The row element, so AnimatePresence can pop exiting rows out of the flow.

    Ref<HTMLLIElement>
FeedHeader5 props
  • statusRequired

    Selected tab.

    "open" | "snoozed" | "resolved"
  • statusesRequired

    Tabs offered, in display order.

    AnomalyStatus[]
  • countsRequired

    Anomalies in each tab.

    Record<AnomalyStatus, number>
  • onStatusChangeRequired

    Called when a tab is chosen.

    (status: AnomalyStatus) => void
  • labelsRequired

    Copy for the title and tabs.

    AnomalyFeedLabels
RollingCount2 props
  • valueRequired

    Count to show; rolls up when it grows and down when it shrinks.

    number
  • className

    Classes for the number.

    string
InvestigateDialog10 props
  • anomalyRequired

    Anomaly to show; keep the last one set while the dialog closes.

    Anomaly | null
  • openRequired

    Whether the dialog is open.

    boolean
  • onOpenChangeRequired

    Called with false when the dialog asks to close.

    (open: boolean) => void
  • onExitComplete

    Runs after the closing animation completes.

    (() => void)
  • styleRequired

    Colors for the anomaly's severity.

    AnomalySeverityStyle | null
  • labelsRequired

    Copy for the dialog.

    AnomalyFeedLabels
  • formatValueRequired

    Formats chart values with the anomaly's unit.

    (value: number, anomaly: Anomaly) => string
  • formatPercentRequired

    Formats the signed deviation, given as a share of expected.

    (share: number) => string
  • formatAgeRequired

    Formats minutes since detection.

    (minutes: number) => string
  • onResolveRequired

    Called once Mark resolved finishes; the dialog then closes.

    (anomaly: Anomaly) => void
RowActions10 props
  • statusRequired

    Status of the row, which picks its actions.

    "open" | "snoozed" | "resolved"
  • metricRequired

    Metric name, used in accessible names.

    string
  • iconOnlyRequired

    Icon-only buttons with tooltips (hover layout), or labelled buttons (touch).

    boolean
  • snoozeOptionsRequired

    Snooze lengths offered, in display order.

    AnomalySnooze[]
  • labelsRequired

    Copy for every action.

    AnomalyFeedLabels
  • onSnoozeRequired

    Called with the chosen snooze length.

    (duration: AnomalySnooze) => void
  • onResolveRequired

    Called when Resolve is pressed.

    () => void
  • onReopenRequired

    Called when Reopen is pressed on a snoozed or resolved row.

    () => void
  • onInvestigateRequired

    Called when Investigate is pressed.

    () => void
  • onMenuChangeRequired

    Called when the snooze menu opens or closes, so the row stays revealed.

    (open: boolean) => void
SegmentChips2 props
  • segmentsRequired

    Segment names, such as `["US", "Mobile"]`.

    string[]
  • className

    Extra classes for the list.

    string
SeverityBadge5 props
  • severityRequired

    Severity to show.

    "info" | "warning" | "critical"
  • styleRequired

    Colors for the severity.

    AnomalySeverityStyle
  • labelsRequired

    Copy for the severity names.

    AnomalyFeedLabels
  • variant

    `dot` for rows (name read by screen readers only), `pill` for the dialog.

    "dot" | "pill"

    Default dot

  • className

    Extra classes.

    string
UndoChip4 props
  • noticeRequired

    The last snooze or resolve, or null when there is nothing to undo.

    AnomalyNotice | null
  • labelsRequired

    Copy for the notice and the undo action.

    AnomalyFeedLabels
  • reduceRequired

    Skip movement, keep fades.

    boolean
  • onUndoRequired

    Called when Undo is pressed.

    () => void
useAnomalyFeed7 props
  • anomaliesRequired

    Anomalies to start with.

    Anomaly[]
  • liveAnomaly

    Anomaly that arrives during the live demo.

    Anomaly
  • liveRequired

    Run the live demo.

    boolean
  • activeRequired

    Only count down to the live arrival while true (the card is on screen).

    boolean
  • liveDelayMsRequired

    Wait before the live anomaly arrives, in ms.

    number
  • lastCheckedMinutesRequired

    Minutes since the last check, shown in the footer at first.

    number
  • noticeMsRequired

    How long the undo chip stays, in ms.

    number
Types6 types

The object types these props take, field by field.

Anomaly11 fields
  • idRequired

    Stable id, used as the row key so rows glide between states.

    string
  • metricRequired

    Metric name, such as "Signups".

    string
  • summaryRequired

    One plain sentence, such as "Signups 32% below forecast".

    string
  • severityRequired

    Urgency, which picks the dot, pill and line colors.

    AnomalySeverity
  • statusRequired

    Tab the anomaly starts in.

    AnomalyStatus
  • segmentsRequired

    Segment chips, such as `["US", "Mobile"]`.

    string[]
  • detectedMinutesAgoRequired

    Minutes since the anomaly was detected; whole numbers keep server and client output equal.

    number
  • pointsRequired

    Buckets for the chart: band, expected and actual values.

    ForecastPoint[]
  • unit

    Unit appended to values, such as `ms` or `%`.

    string
  • causes

    Likely causes listed in the investigate dialog.

    AnomalyCause[]
  • snoozedFor

    Snooze length, set when the anomaly is snoozed.

    AnomalySnooze
AnomalySeverityStyle3 fields
  • dotRequired

    Dot fill class, such as `bg-rose-500`. Also used by the chart marker.

    string
  • pillRequired

    Tinted pill classes for the severity label.

    string
  • strokeRequired

    Stroke class for the line where it leaves the band.

    string
AnomalyFooterInfo3 fields
  • openRequired

    Anomalies in the Open tab.

    number
  • criticalRequired

    Open anomalies marked critical.

    number
  • checkedMinutesAgoRequired

    Minutes since the last check.

    number
AnomalyFeedLabels33 fields
  • titleRequired

    Card heading.

    string
  • tabsRequired

    Accessible name for the status tabs.

    string
  • openRequired

    Tab label for open anomalies.

    string
  • snoozedRequired

    Tab label for snoozed anomalies.

    string
  • resolvedRequired

    Tab label for resolved anomalies.

    string
  • criticalRequired

    Severity label for critical anomalies.

    string
  • warningRequired

    Severity label for warnings.

    string
  • infoRequired

    Severity label for informational anomalies.

    string
  • snoozeRequired

    Snooze menu trigger.

    string
  • snooze1hRequired

    Snooze option for one hour.

    string
  • snooze1dRequired

    Snooze option for one day.

    string
  • snooze1wRequired

    Snooze option for one week.

    string
  • resolveRequired

    Resolve action.

    string
  • investigateRequired

    Investigate action.

    string
  • reopenRequired

    Reopen action for snoozed and resolved rows.

    string
  • undoRequired

    Undo action in the confirmation chip.

    string
  • snoozedNoticeRequired

    Confirmation after a snooze.

    string
  • resolvedNoticeRequired

    Confirmation after a resolve.

    string
  • reopenedNoticeRequired

    Confirmation after a reopen.

    string
  • emptyOpenRequired

    Empty state heading for the Open tab.

    string
  • emptySnoozedRequired

    Empty state heading for the Snoozed tab.

    string
  • emptyResolvedRequired

    Empty state heading for the Resolved tab.

    string
  • emptyHintRequired

    Empty state line under each heading.

    string
  • deviationRequired

    Dialog stat: deviation from forecast.

    string
  • actualRequired

    Dialog stat: measured value.

    string
  • expectedRequired

    Dialog stat: forecast value.

    string
  • detectedRequired

    Dialog stat: detection time.

    string
  • causesRequired

    Dialog heading over the causes list.

    string
  • noCausesRequired

    Dialog line when no causes are known.

    string
  • closeRequired

    Dialog close button.

    string
  • markResolvedRequired

    Dialog resolve button.

    string
  • resolvingRequired

    Dialog resolve button while saving.

    string
  • resolvedDoneRequired

    Dialog resolve button once done.

    string
AnomalyCause4 fields
  • idRequired

    Stable id, used as the list key.

    string
  • labelRequired

    One plain sentence, such as "Release v2.4 deployed 14m earlier".

    string
  • detail

    Short context on the right, such as a time or a source.

    string
  • kind

    Icon shown in the cause's chip.

    "release" | "campaign" | "incident" | "traffic"
AnomalyNotice5 fields
  • keyRequired

    Changes on every action so the chip restarts its timer.

    number
  • idRequired

    Anomaly that moved.

    string
  • statusRequired

    Where it moved to.

    AnomalyStatus
  • previousRequired

    Where it came from, restored by undo.

    AnomalyStatus
  • previousSnooze

    Snooze length it had before, restored by undo.

    AnomalySnooze