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 参考
除标注为必填的属性外,其余均为可选。数据、文案和颜色默认使用示例内容。
AnomalyFeed21 个属性
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 个属性
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 个属性
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 个属性
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 个属性
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 个属性
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 个属性
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 个属性
value必填Count to show; rolls up when it grows and down when it shrinks.
numberclassNameClasses for the number.
string
InvestigateDialog10 个属性
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 个属性
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 个属性
segments必填Segment names, such as `["US", "Mobile"]`.
string[]classNameExtra classes for the list.
string
SeverityBadge5 个属性
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 个属性
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 个属性
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 个类型
这些属性使用的对象类型及其字段。
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