Anomaly Feed
1 バリエーション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
- CriticalSignupsUSMobile12m ago
- WarningCheckout latencyEUWeb38m ago
- InfoOrganic 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>
);
}
インストール
API リファレンス
必須と記された props 以外はすべて省略できます。データ、文言、色はサンプルの内容が既定値です。
AnomalyFeed21 個の props
anomaliesAnomalies to start with, newest first. Pass a stable (memoized) array.
Anomaly[]liveAnomalyAnomaly that arrives at the top during the live demo.
AnomalyliveRun the live demo: one new anomaly arrives a few seconds after the card is visible.
boolean既定値
trueliveDelayMsWait before the live anomaly arrives, in ms.
number既定値
4000statusSelected tab (controlled).
"open" | "snoozed" | "resolved"defaultStatusSelected tab when uncontrolled.
"open" | "snoozed" | "resolved"既定値
openonStatusChangeCalled when a tab is chosen.
((status: AnomalyStatus) => void)snoozeOptionsSnooze lengths offered in the row menu.
AnomalySnooze[]既定値
["1h", "1d", "1w"]severityStylesColors for each severity; any left out keeps its default.
Partial<Record<AnomalySeverity, AnomalySeverityStyle>>lastCheckedMinutesMinutes since the last check, shown in the footer until a new anomaly arrives.
number既定値
1undoMsHow long the undo chip stays after an action, in ms.
number既定値
4000formatAgeFormats minutes since detection, such as "12m ago".
((minutes: number) => string)formatValueFormats chart values with the anomaly's unit.
((value: number, anomaly: Anomaly) => string)formatPercentFormats a signed deviation, given as a share of expected.
((share: number) => string)formatFooterBuilds the footer line from the open and critical counts.
((info: AnomalyFooterInfo) => string)onSnoozeCalled when an anomaly is snoozed, with the chosen length.
((anomaly: Anomaly, duration: AnomalySnooze) => void)onResolveCalled when an anomaly is resolved from its row or the dialog.
((anomaly: Anomaly) => void)onReopenCalled when a snoozed or resolved anomaly is reopened.
((anomaly: Anomaly) => void)onInvestigateCalled when the investigate dialog opens for an anomaly.
((anomaly: Anomaly) => void)labelsCopy overrides; anything left out uses the English defaults.
Partial<AnomalyFeedLabels>classNameClasses for the card.
string
AnomalyCauses4 個の props
causes必須Causes to list, most likely first.
AnomalyCause[]heading必須Heading over the list.
stringempty必須Line shown when there are no causes.
stringreduce必須Skip movement, keep fades.
boolean
AnomalyEmptyIllustration3 個の props
status必須Tab the empty state belongs to, which picks the badge glyph.
"open" | "snoozed" | "resolved"accentClassNameAccent class for the badge, such as `text-emerald-500`.
string既定値
text-emerald-500classNameExtra classes for the svg.
string
AnomalyList12 個の props
items必須Anomalies in the selected tab, newest first.
Anomaly[]status必須Selected tab, which picks the empty state.
"open" | "snoozed" | "resolved"severityStyles必須Colors for each severity.
Record<AnomalySeverity, AnomalySeverityStyle>reduce必須Skip movement, keep fades.
booleancanHover必須Hover-capable pointer: actions reveal on hover.
booleansnoozeOptions必須Snooze lengths offered in the menu.
AnomalySnooze[]labels必須Copy for rows and empty states.
AnomalyFeedLabelsformatAge必須Formats minutes since detection.
(minutes: number) => stringonSnooze必須Called with an anomaly and the chosen snooze length.
(anomaly: Anomaly, duration: AnomalySnooze) => voidonResolve必須Called when an anomaly is resolved.
(anomaly: Anomaly) => voidonReopen必須Called when a snoozed or resolved anomaly is reopened.
(anomaly: Anomaly) => voidonInvestigate必須Called when an anomaly is opened for investigation.
(anomaly: Anomaly) => void
AnomalyMiniChart6 個の props
anomaly必須Anomaly whose buckets to draw.
Anomalystyle必須Colors for the anomaly's severity.
AnomalySeverityStylepulse必須Pulse the anomaly marker while visible.
booleandelay必須Seconds before the actual line starts drawing.
numberlabel必須Accessible summary of the chart.
stringclassNameClasses for the chart box.
string
AnomalyRow13 個の props
anomaly必須The anomaly to draw.
Anomalystyle必須Colors for the anomaly's severity.
AnomalySeverityStyledelay必須Entrance delay in seconds; 0 for rows that join after the list opens.
numberreduce必須Skip movement, keep fades.
booleancanHover必須Hover-capable pointer: actions reveal on hover; otherwise they always show.
booleansnoozeOptions必須Snooze lengths offered in the menu.
AnomalySnooze[]labels必須Copy for actions and the severity name.
AnomalyFeedLabelsformatAge必須Formats minutes since detection.
(minutes: number) => stringonSnooze必須Called with the chosen snooze length.
(duration: AnomalySnooze) => voidonResolve必須Called when Resolve is pressed.
() => voidonReopen必須Called when Reopen is pressed.
() => voidonInvestigate必須Called when the row or Investigate is pressed.
() => voidrefThe row element, so AnimatePresence can pop exiting rows out of the flow.
Ref<HTMLLIElement>
FeedHeader5 個の props
status必須Selected tab.
"open" | "snoozed" | "resolved"statuses必須Tabs offered, in display order.
AnomalyStatus[]counts必須Anomalies in each tab.
Record<AnomalyStatus, number>onStatusChange必須Called when a tab is chosen.
(status: AnomalyStatus) => voidlabels必須Copy for the title and tabs.
AnomalyFeedLabels
RollingCount2 個の props
value必須Count to show; rolls up when it grows and down when it shrinks.
numberclassNameClasses for the number.
string
InvestigateDialog10 個の props
anomaly必須Anomaly to show; keep the last one set while the dialog closes.
Anomaly | nullopen必須Whether the dialog is open.
booleanonOpenChange必須Called with false when the dialog asks to close.
(open: boolean) => voidonExitCompleteRuns after the closing animation completes.
(() => void)style必須Colors for the anomaly's severity.
AnomalySeverityStyle | nulllabels必須Copy for the dialog.
AnomalyFeedLabelsformatValue必須Formats chart values with the anomaly's unit.
(value: number, anomaly: Anomaly) => stringformatPercent必須Formats the signed deviation, given as a share of expected.
(share: number) => stringformatAge必須Formats minutes since detection.
(minutes: number) => stringonResolve必須Called once Mark resolved finishes; the dialog then closes.
(anomaly: Anomaly) => void
RowActions10 個の props
status必須Status of the row, which picks its actions.
"open" | "snoozed" | "resolved"metric必須Metric name, used in accessible names.
stringiconOnly必須Icon-only buttons with tooltips (hover layout), or labelled buttons (touch).
booleansnoozeOptions必須Snooze lengths offered, in display order.
AnomalySnooze[]labels必須Copy for every action.
AnomalyFeedLabelsonSnooze必須Called with the chosen snooze length.
(duration: AnomalySnooze) => voidonResolve必須Called when Resolve is pressed.
() => voidonReopen必須Called when Reopen is pressed on a snoozed or resolved row.
() => voidonInvestigate必須Called when Investigate is pressed.
() => voidonMenuChange必須Called when the snooze menu opens or closes, so the row stays revealed.
(open: boolean) => void
SegmentChips2 個の props
segments必須Segment names, such as `["US", "Mobile"]`.
string[]classNameExtra classes for the list.
string
SeverityBadge5 個の props
severity必須Severity to show.
"info" | "warning" | "critical"style必須Colors for the severity.
AnomalySeverityStylelabels必須Copy for the severity names.
AnomalyFeedLabelsvariant`dot` for rows (name read by screen readers only), `pill` for the dialog.
"dot" | "pill"既定値
dotclassNameExtra classes.
string
UndoChip4 個の props
notice必須The last snooze or resolve, or null when there is nothing to undo.
AnomalyNotice | nulllabels必須Copy for the notice and the undo action.
AnomalyFeedLabelsreduce必須Skip movement, keep fades.
booleanonUndo必須Called when Undo is pressed.
() => void
useAnomalyFeed7 個の props
anomalies必須Anomalies to start with.
Anomaly[]liveAnomalyAnomaly that arrives during the live demo.
Anomalylive必須Run the live demo.
booleanactive必須Only count down to the live arrival while true (the card is on screen).
booleanliveDelayMs必須Wait before the live anomaly arrives, in ms.
numberlastCheckedMinutes必須Minutes since the last check, shown in the footer at first.
numbernoticeMs必須How long the undo chip stays, in ms.
number
型6 個の型
これらの props が受け取るオブジェクト型とそのフィールド。
Anomaly11 個のフィールド
id必須Stable id, used as the row key so rows glide between states.
stringmetric必須Metric name, such as "Signups".
stringsummary必須One plain sentence, such as "Signups 32% below forecast".
stringseverity必須Urgency, which picks the dot, pill and line colors.
AnomalySeveritystatus必須Tab the anomaly starts in.
AnomalyStatussegments必須Segment chips, such as `["US", "Mobile"]`.
string[]detectedMinutesAgo必須Minutes since the anomaly was detected; whole numbers keep server and client output equal.
numberpoints必須Buckets for the chart: band, expected and actual values.
ForecastPoint[]unitUnit appended to values, such as `ms` or `%`.
stringcausesLikely causes listed in the investigate dialog.
AnomalyCause[]snoozedForSnooze length, set when the anomaly is snoozed.
AnomalySnooze
AnomalySeverityStyle3 個のフィールド
dot必須Dot fill class, such as `bg-rose-500`. Also used by the chart marker.
stringpill必須Tinted pill classes for the severity label.
stringstroke必須Stroke class for the line where it leaves the band.
string
AnomalyFooterInfo3 個のフィールド
open必須Anomalies in the Open tab.
numbercritical必須Open anomalies marked critical.
numbercheckedMinutesAgo必須Minutes since the last check.
number
AnomalyFeedLabels33 個のフィールド
title必須Card heading.
stringtabs必須Accessible name for the status tabs.
stringopen必須Tab label for open anomalies.
stringsnoozed必須Tab label for snoozed anomalies.
stringresolved必須Tab label for resolved anomalies.
stringcritical必須Severity label for critical anomalies.
stringwarning必須Severity label for warnings.
stringinfo必須Severity label for informational anomalies.
stringsnooze必須Snooze menu trigger.
stringsnooze1h必須Snooze option for one hour.
stringsnooze1d必須Snooze option for one day.
stringsnooze1w必須Snooze option for one week.
stringresolve必須Resolve action.
stringinvestigate必須Investigate action.
stringreopen必須Reopen action for snoozed and resolved rows.
stringundo必須Undo action in the confirmation chip.
stringsnoozedNotice必須Confirmation after a snooze.
stringresolvedNotice必須Confirmation after a resolve.
stringreopenedNotice必須Confirmation after a reopen.
stringemptyOpen必須Empty state heading for the Open tab.
stringemptySnoozed必須Empty state heading for the Snoozed tab.
stringemptyResolved必須Empty state heading for the Resolved tab.
stringemptyHint必須Empty state line under each heading.
stringdeviation必須Dialog stat: deviation from forecast.
stringactual必須Dialog stat: measured value.
stringexpected必須Dialog stat: forecast value.
stringdetected必須Dialog stat: detection time.
stringcauses必須Dialog heading over the causes list.
stringnoCauses必須Dialog line when no causes are known.
stringclose必須Dialog close button.
stringmarkResolved必須Dialog resolve button.
stringresolving必須Dialog resolve button while saving.
stringresolvedDone必須Dialog resolve button once done.
string
AnomalyCause4 個のフィールド
id必須Stable id, used as the list key.
stringlabel必須One plain sentence, such as "Release v2.4 deployed 14m earlier".
stringdetailShort context on the right, such as a time or a source.
stringkindIcon shown in the cause's chip.
"release" | "campaign" | "incident" | "traffic"
AnomalyNotice5 個のフィールド
key必須Changes on every action so the chip restarts its timer.
numberid必須Anomaly that moved.
stringstatus必須Where it moved to.
AnomalyStatusprevious必須Where it came from, restored by undo.
AnomalyStatuspreviousSnoozeSnooze length it had before, restored by undo.
AnomalySnooze