Skip to content

Open-source status page, incident response and uptime monitoring

chore: registry component highlighter (#1839)

Maximilian Kaskedc849cfc33c5
diff --git a/apps/web/src/content/component-highlighter.tsx b/apps/web/src/content/component-highlighter.tsx
new file mode 100644
index 000000000..15bd32293
--- /dev/null
+++ b/apps/web/src/content/component-highlighter.tsx
@@ -0,0 +1,158 @@
+"use client";
+
+import { useCallback, useRef, useState } from "react";
+
+/**
+ * Mapping of data-slot values to component names for display
+ */
+const DATA_SLOT_TO_COMPONENT: Record<string, string> = {
+ // Layout components
+ status: "Status",
+ "status-header": "StatusHeader",
+ "status-title": "StatusTitle",
+ "status-description": "StatusDescription",
+ "status-content": "StatusContent",
+
+ // Banner components
+ "status-banner": "StatusBanner",
+
+ // Monitor components
+ "status-component": "StatusComponent",
+ "status-component-header": "StatusComponentHeader",
+ "status-component-header-left": "StatusComponentHeaderLeft",
+ "status-component-header-right": "StatusComponentHeaderRight",
+ "status-component-body": "StatusComponentBody",
+ "status-component-title": "StatusComponentTitle",
+ "status-component-uptime": "StatusComponentUptime",
+ "status-component-status": "StatusComponentStatus",
+ "status-component-footer": "StatusComponentFooter",
+
+ // Group component
+ "status-component-group": "StatusComponentGroup",
+ "status-component-group-trigger": "StatusComponentGroupTrigger",
+ "status-component-group-content": "StatusComponentGroupContent",
+
+ // Feed component
+ "status-feed": "StatusFeed",
+
+ // Event components
+ "status-event-group": "StatusEventGroup",
+ "status-event": "StatusEvent",
+ "status-event-content": "StatusEventContent",
+ "status-event-title": "StatusEventTitle",
+ "status-event-title-check": "StatusEventTitleCheck",
+ "status-event-affected": "StatusEventAffected",
+ "status-event-affected-badge": "StatusEventAffectedBadge",
+ "status-event-date": "StatusEventDate",
+ "status-event-date-badge": "StatusEventDateBadge",
+ "status-event-aside": "StatusEventAside",
+ "status-event-timeline-report": "StatusEventTimelineReport",
+ "status-event-timeline-report-update": "StatusEventTimelineReportUpdate",
+ "status-event-timeline-maintenance": "StatusEventTimelineMaintenance",
+ "status-event-timeline-title": "StatusEventTimelineTitle",
+ "status-event-timeline-message": "StatusEventTimelineMessage",
+ "status-event-timeline-dot": "StatusEventTimelineDot",
+ "status-event-timeline-separator": "StatusEventTimelineSeparator",
+
+ // Bar components
+ "status-bar": "StatusBar",
+ "status-bar-item": "StatusBarItem",
+ "status-bar-card": "StatusBarCard",
+ "status-bar-content": "StatusBarContent",
+ "status-bar-event": "StatusBarEvent",
+
+ // Utility components
+ "status-timestamp": "StatusTimestamp",
+ "status-timestamp-content": "StatusTimestampContent",
+ "status-timestamp-row": "StatusTimestampRow",
+};
+
+/**
+ * Find the nearest element with a data-slot attribute by traversing up the DOM tree
+ */
+function findNearestSlot(target: HTMLElement, root: HTMLElement) {
+ let el: HTMLElement | null = target;
+ while (el && el !== root) {
+ const slot = el.dataset.slot;
+ if (slot) {
+ const componentName = DATA_SLOT_TO_COMPONENT[slot] || slot;
+ return { element: el, name: componentName };
+ }
+ el = el.parentElement;
+ }
+ return null;
+}
+
+/**
+ * ComponentHighlighter
+ *
+ * Highlights OpenStatus components on hover by detecting their data-slot attributes.
+ * Uses DOM inspection to find components, which works reliably at any nesting level.
+ *
+ * @param enabled - Control the highlighter state externally (optional)
+ * @param children - The component tree to enable highlighting for
+ *
+ * @example
+ * ```tsx
+ * <ComponentHighlighter>
+ * <StatusPageExample />
+ * </ComponentHighlighter>
+ * ```
+ */
+export function ComponentHighlighter({
+ enabled = true,
+ children,
+}: {
+ enabled?: boolean;
+ shortcut?: boolean;
+ children: React.ReactNode;
+}) {
+ const rootRef = useRef<HTMLDivElement>(null);
+
+ const [hovered, setHovered] = useState<{
+ rect: DOMRect;
+ name: string;
+ } | null>(null);
+
+ // Find and highlight the nearest component with data-slot on mouse move
+ const handleMouseMove = useCallback(
+ (e: React.MouseEvent) => {
+ if (!enabled || !rootRef.current) return;
+ const match = findNearestSlot(e.target as HTMLElement, rootRef.current);
+ if (match) {
+ setHovered({
+ rect: match.element.getBoundingClientRect(),
+ name: match.name,
+ });
+ } else {
+ setHovered(null);
+ }
+ },
+ [enabled],
+ );
+
+ return (
+ <div
+ ref={rootRef}
+ onMouseMove={enabled ? handleMouseMove : undefined}
+ onMouseLeave={enabled ? () => setHovered(null) : undefined}
+ >
+ {children}
+ {hovered && (
+ <div
+ className="pointer-events-none fixed z-[99999] bg-info/5 outline-2 outline-info transition-all duration-100 ease-in-out"
+ style={{
+ top: hovered.rect.top,
+ left: hovered.rect.left,
+ width: hovered.rect.width,
+ height: hovered.rect.height,
+ }}
+ >
+ <span className="-left-px -top-px absolute whitespace-nowrap bg-info px-2 py-0.5 font-mono font-semibold text-[11px] text-white leading-tight">
+ {hovered.name}
+ </span>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/apps/web/src/content/mdx.tsx b/apps/web/src/content/mdx.tsx
index 4b2d1ee78..9f3f876b3 100644
--- a/apps/web/src/content/mdx.tsx
+++ b/apps/web/src/content/mdx.tsx
@@ -9,6 +9,7 @@ import Link from "next/link";
import React from "react";
import { Tweet, type TweetProps } from "react-tweet";
import { highlight } from "sugar-high";
+import { ComponentHighlighter } from "./component-highlighter";
import { CopyButton } from "./copy-button";
import { HighlightText } from "./highlight-text";
import { ImageZoom } from "./image-zoom";
@@ -363,7 +364,11 @@ export const components = {
</div>
);
},
- StatusPageExample,
+ StatusPageExample: () => (
+ <ComponentHighlighter>
+ <StatusPageExample />
+ </ComponentHighlighter>
+ ),
};
function MDXContent(props: MDXRemoteProps) {
diff --git a/apps/web/src/content/pages/unrelated/registry.mdx b/apps/web/src/content/pages/unrelated/registry.mdx
index 263b5525d..d3b1ed4d1 100644
--- a/apps/web/src/content/pages/unrelated/registry.mdx
+++ b/apps/web/src/content/pages/unrelated/registry.mdx
@@ -6,7 +6,7 @@ description: "Install beautiful, accessible React components for status pages. P
category: "Documentation"
---
-Build your status page in minutes, not hours. The Openstatus registry gives you production-ready React components specifically designed for status pages. Built on top of shadcn/ui, these components are accessible, customizable, and battle-tested in production.
+Build your status page in minutes, not hours. The Openstatus registry gives you production-ready React components specifically designed for status pages. Built on top of [shadcn/ui](https://ui.shadcn.com), these components are accessible, customizable, and battle-tested in production.
## What is the Registry?
@@ -20,6 +20,8 @@ All components are:
## Complete Example
+Hover the example below to learn which component is being used.
+
<Grid cols={1}>
<div>
@@ -36,7 +38,7 @@ See the [complete example](https://github.com/openstatusHQ/openstatus/tree/main/
## Installation
-Install any component with a single command:
+Install any component with a single [shadcn CLI](https://ui.shadcn.com/docs/cli) command:
```bash
npx shadcn@latest add https://openstatus.dev/r/status-complete
diff --git a/apps/web/src/content/shadcn-registry-example.tsx b/apps/web/src/content/shadcn-registry-example.tsx
index 9b1e10a99..4daa74ea1 100644
--- a/apps/web/src/content/shadcn-registry-example.tsx
+++ b/apps/web/src/content/shadcn-registry-example.tsx
@@ -367,7 +367,10 @@ export function StatusPageExample() {
: "success";
return (
- <Status variant={systemStatus} className="mx-auto max-w-2xl">
+ <Status
+ variant={systemStatus}
+ className="mx-auto max-w-[800px] px-2 py-2 sm:px-4 md:px-[125px]"
+ >
<StatusHeader>
<StatusTitle>System Status</StatusTitle>
<StatusDescription>
diff --git a/packages/ui/src/components/blocks/status-banner.tsx b/packages/ui/src/components/blocks/status-banner.tsx
index 4b57268c7..68c968241 100644
--- a/packages/ui/src/components/blocks/status-banner.tsx
+++ b/packages/ui/src/components/blocks/status-banner.tsx
@@ -68,6 +68,7 @@ export function StatusBanner({
</StatusBannerContainer>
);
}
+StatusBanner.displayName = "StatusBanner";
/**
* StatusBannerContainer - Base container for status banner composition
@@ -122,6 +123,7 @@ export function StatusBannerContainer({
</div>
);
}
+StatusBannerContainer.displayName = "StatusBannerContainer";
/**
* StatusBannerMessage - Automatic status message display
@@ -217,6 +219,7 @@ export function StatusBannerTitle({
</div>
);
}
+StatusBannerTitle.displayName = "StatusBannerTitle";
/**
* StatusBannerContent - Main content area for banner messages
@@ -254,6 +257,7 @@ export function StatusBannerContent({
</div>
);
}
+StatusBannerContent.displayName = "StatusBannerContent";
/**
* StatusBannerIcon - Status indicator icon for banner context
@@ -287,6 +291,7 @@ export function StatusBannerIcon({
<UnifiedStatusIcon variant="banner" className={className} {...props} />
);
}
+StatusBannerIcon.displayName = "StatusBannerIcon";
// ============================================================================
// Tab Components
diff --git a/packages/ui/src/components/blocks/status-bar.tsx b/packages/ui/src/components/blocks/status-bar.tsx
index 3f53eef03..36ee75d99 100644
--- a/packages/ui/src/components/blocks/status-bar.tsx
+++ b/packages/ui/src/components/blocks/status-bar.tsx
@@ -240,7 +240,7 @@ function useStatusBar({ dataLength, isTouch }: UseStatusBarProps) {
{
// Navigate to previous monitor's status bar
const prevMonitor = containerRef.current?.closest(
- '[data-slot="status-monitor"]',
+ '[data-slot="status-component"]',
)?.previousElementSibling;
if (prevMonitor) {
const prevBar = prevMonitor.querySelector('[role="toolbar"]');
@@ -258,7 +258,7 @@ function useStatusBar({ dataLength, isTouch }: UseStatusBarProps) {
{
// Navigate to next monitor's status bar
const nextMonitor = containerRef.current?.closest(
- '[data-slot="status-monitor"]',
+ '[data-slot="status-component"]',
)?.nextElementSibling;
if (nextMonitor) {
const nextBar = nextMonitor.querySelector('[role="toolbar"]');
@@ -434,6 +434,7 @@ export function StatusBar({
<div
ref={containerRef}
className="flex h-[50px] w-full items-end"
+ data-slot="status-bar"
role="toolbar"
aria-label="Status tracker"
>
@@ -461,6 +462,7 @@ export function StatusBar({
</div>
);
}
+StatusBar.displayName = "StatusBar";
interface StatusBarItemProps {
index: number;
@@ -511,6 +513,7 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
aria-label={`Day ${index + 1} status`}
aria-pressed={isPinned}
aria-expanded={isActive}
+ data-slot="status-bar-item"
>
{/* Render bar segments */}
{item.bar.map((segment, segmentIndex) => {
@@ -558,7 +561,6 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
);
},
);
-
StatusBarItem.displayName = "StatusBarItem";
interface StatusBarCardProps {
@@ -595,7 +597,7 @@ function StatusBarCard({
renderEvent,
}: StatusBarCardProps) {
return (
- <div>
+ <div data-slot="status-bar-card">
<div className="p-2 text-xs">
{new Date(item.day).toLocaleDateString("default", {
day: "numeric",
@@ -653,6 +655,7 @@ function StatusBarCard({
</div>
);
}
+StatusBarCard.displayName = "StatusBarCard";
/**
* StatusBarSkeleton - Loading skeleton for StatusBar
@@ -682,6 +685,7 @@ export function StatusBarSkeleton({
/>
);
}
+StatusBarSkeleton.displayName = "StatusBarSkeleton";
/**
* StatusBarContent - Internal component for status breakdown rows
@@ -707,7 +711,7 @@ function StatusBarContent({
value: string;
}) {
return (
- <div className="flex items-baseline gap-4">
+ <div className="flex items-baseline gap-4" data-slot="status-bar-content">
<div className="flex items-center gap-2">
<div
className="h-2.5 w-2.5 rounded-sm"
@@ -723,6 +727,7 @@ function StatusBarContent({
</div>
);
}
+StatusBarContent.displayName = "StatusBarContent";
/**
* StatusBarEvent - Event badge for incidents and maintenance
@@ -790,7 +795,7 @@ export function StatusBarEvent({
type === "incident" ? "error" : type === "report" ? "degraded" : "info";
return (
- <div className="group relative text-sm">
+ <div className="group relative text-sm" data-slot="status-bar-event">
{/* NOTE: this is to make the text truncate based on the width of the sibling element */}
{/* REMINDER: height needs to be equal the text height */}
<div className="h-4 w-full" />
@@ -814,6 +819,7 @@ export function StatusBarEvent({
</div>
);
}
+StatusBarEvent.displayName = "StatusBarEvent";
/**
* formatDuration - Internal helper for formatting event durations
diff --git a/packages/ui/src/components/blocks/status-component-group.tsx b/packages/ui/src/components/blocks/status-component-group.tsx
index 14135b9e6..8d6f7274a 100644
--- a/packages/ui/src/components/blocks/status-component-group.tsx
+++ b/packages/ui/src/components/blocks/status-component-group.tsx
@@ -121,7 +121,7 @@ export function StatusComponentGroup({
className,
defaultOpen = false,
...props
-}: React.ComponentProps<typeof CollapsibleTrigger> & {
+}: React.ComponentProps<"div"> & {
title: string;
status?: Exclude<StatusType, "empty">;
children?: React.ReactNode;
@@ -134,41 +134,45 @@ export function StatusComponentGroup({
}, []);
return (
- <Collapsible
- defaultOpen={defaultOpen}
- className={cn(
- "-mx-3",
- "rounded-lg border border-transparent bg-muted/50 hover:border-border/50 data-[state=open]:border-border/50 data-[state=open]:bg-muted/50",
- className,
- )}
- >
- <CollapsibleTrigger
+ <div data-slot="status-component-group" {...props}>
+ <Collapsible
+ defaultOpen={defaultOpen}
className={cn(
- "group/component flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium font-mono",
- "cursor-pointer",
+ "-mx-3",
+ "rounded-lg border border-transparent bg-muted/50 hover:border-border/50 data-[state=open]:border-border/50 data-[state=open]:bg-muted/50",
className,
)}
- data-variant={status}
- aria-label={`Toggle ${title} status details`}
- {...props}
>
- {title}
- <div className="flex items-center gap-2">
- <StatusComponentStatus className="text-sm" />
- <StatusComponentIcon />
- </div>
- </CollapsibleTrigger>
- <CollapsibleContent
- data-animate={mounted}
- className={cn(
- "flex flex-col gap-3 border-border/50 border-t px-3 py-2",
- "overflow-hidden",
- // REMINDER: otherwise, if defaultOpen is true, the animation will be triggered and we have a layout shift
- "data-[animate=true]:data-[state=closed]:animate-collapsible-up data-[animate=true]:data-[state=open]:animate-collapsible-down",
- )}
- >
- {children}
- </CollapsibleContent>
- </Collapsible>
+ <CollapsibleTrigger
+ data-slot="status-component-group-trigger"
+ className={cn(
+ "group/component flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium font-mono",
+ "cursor-pointer",
+ className,
+ )}
+ data-variant={status}
+ aria-label={`Toggle ${title} status details`}
+ >
+ {title}
+ <div className="flex items-center gap-2">
+ <StatusComponentStatus className="text-sm" />
+ <StatusComponentIcon />
+ </div>
+ </CollapsibleTrigger>
+ <CollapsibleContent
+ data-slot="status-component-group-content"
+ data-animate={mounted}
+ className={cn(
+ "flex flex-col gap-3 border-border/50 border-t px-3 py-2",
+ "overflow-hidden",
+ // REMINDER: otherwise, if defaultOpen is true, the animation will be triggered and we have a layout shift
+ "data-[animate=true]:data-[state=closed]:animate-collapsible-up data-[animate=true]:data-[state=open]:animate-collapsible-down",
+ )}
+ >
+ {children}
+ </CollapsibleContent>
+ </Collapsible>
+ </div>
);
}
+StatusComponentGroup.displayName = "StatusComponentGroup";
diff --git a/packages/ui/src/components/blocks/status-component.tsx b/packages/ui/src/components/blocks/status-component.tsx
index 0e61b21b9..d3961dae9 100644
--- a/packages/ui/src/components/blocks/status-component.tsx
+++ b/packages/ui/src/components/blocks/status-component.tsx
@@ -73,7 +73,7 @@ export function StatusComponent({
}: StatusComponentProps) {
return (
<div
- data-slot="status-monitor"
+ data-slot="status-component"
data-variant={variant}
className={cn("group/component space-y-2", className)}
{...props}
@@ -82,6 +82,7 @@ export function StatusComponent({
</div>
);
}
+StatusComponent.displayName = "StatusComponent";
// ============================================================================
// Header Components
@@ -116,6 +117,7 @@ export function StatusComponentHeader({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-component-header"
className={cn("flex items-center justify-between", className)}
{...props}
>
@@ -123,6 +125,7 @@ export function StatusComponentHeader({
</div>
);
}
+StatusComponentHeader.displayName = "StatusComponentHeader";
/**
* StatusComponentHeaderLeft - Left-aligned header content container
@@ -151,11 +154,16 @@ export function StatusComponentHeaderLeft({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("flex items-center gap-2", className)} {...props}>
+ <div
+ data-slot="status-component-header-left"
+ className={cn("flex items-center gap-2", className)}
+ {...props}
+ >
{children}
</div>
);
}
+StatusComponentHeaderLeft.displayName = "StatusComponentHeaderLeft";
/**
* StatusComponentHeaderRight - Right-aligned header content container
@@ -180,11 +188,16 @@ export function StatusComponentHeaderRight({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("flex items-center gap-3", className)} {...props}>
+ <div
+ data-slot="status-component-header-right"
+ className={cn("flex items-center gap-3", className)}
+ {...props}
+ >
{children}
</div>
);
}
+StatusComponentHeaderRight.displayName = "StatusComponentHeaderRight";
// ============================================================================
// Content Components
@@ -213,11 +226,16 @@ export function StatusComponentBody({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("space-y-2", className)} {...props}>
+ <div
+ data-slot="status-component-body"
+ className={cn("space-y-2", className)}
+ {...props}
+ >
{children}
</div>
);
}
+StatusComponentBody.displayName = "StatusComponentBody";
// ============================================================================
// Display Components
@@ -248,6 +266,7 @@ export function StatusComponentTitle({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-component-title"
className={cn(
"truncate font-medium font-mono text-base text-foreground leading-5",
className,
@@ -258,6 +277,7 @@ export function StatusComponentTitle({
</div>
);
}
+StatusComponentTitle.displayName = "StatusComponentTitle";
/**
* StatusComponentDescription - Info icon with tooltip for additional details
@@ -316,6 +336,7 @@ export function StatusComponentDescription({
</TooltipProvider>
);
}
+StatusComponentDescription.displayName = "StatusComponentDescription";
/**
* StatusComponentIcon - Status indicator icon for component context
@@ -352,6 +373,7 @@ export function StatusComponentIcon({
<UnifiedStatusIcon variant="component" className={className} {...props} />
);
}
+StatusComponentIcon.displayName = "StatusComponentIcon";
/**
* StatusComponentFooter - Date range footer for status visualizations
@@ -389,7 +411,10 @@ export function StatusComponentFooter({
isLoading?: boolean;
}) {
return (
- <div className="flex flex-row items-center justify-between font-mono text-muted-foreground text-xs leading-none">
+ <div
+ data-slot="status-component-footer"
+ className="flex flex-row items-center justify-between font-mono text-muted-foreground text-xs leading-none"
+ >
<div>
{isLoading ? (
<Skeleton className="h-3 w-18" />
@@ -406,6 +431,7 @@ export function StatusComponentFooter({
</div>
);
}
+StatusComponentFooter.displayName = "StatusComponentFooter";
/**
* StatusComponentUptime - Uptime percentage display
@@ -434,16 +460,18 @@ export function StatusComponentUptime({
}: React.ComponentProps<"div">) {
return (
<div
- {...props}
+ data-slot="status-component-uptime"
className={cn(
"font-mono text-foreground/80 text-sm leading-none",
className,
)}
+ {...props}
>
{children}
</div>
);
}
+StatusComponentUptime.displayName = "StatusComponentUptime";
/**
* StatusComponentUptimeSkeleton - Loading skeleton for uptime percentage
@@ -514,6 +542,7 @@ export function StatusComponentStatus({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-component-status"
className={cn(
"font-mono text-sm leading-none",
"group-data-[variant=success]/component:text-success",
@@ -539,3 +568,4 @@ export function StatusComponentStatus({
</div>
);
}
+StatusComponentStatus.displayName = "StatusComponentStatus";
diff --git a/packages/ui/src/components/blocks/status-events.tsx b/packages/ui/src/components/blocks/status-events.tsx
index 8315852bc..0e2b7eaed 100644
--- a/packages/ui/src/components/blocks/status-events.tsx
+++ b/packages/ui/src/components/blocks/status-events.tsx
@@ -50,6 +50,7 @@ export function StatusEventGroup({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-event-group"
className={cn("flex flex-col gap-4", className)}
role="feed"
aria-label="Status events and updates"
@@ -85,7 +86,11 @@ export function StatusEvent({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("relative flex flex-col gap-2", className)} {...props}>
+ <div
+ data-slot="status-event"
+ className={cn("relative flex flex-col gap-2", className)}
+ {...props}
+ >
{children}
</div>
);
@@ -121,6 +126,7 @@ export function StatusEventContent({
}) {
return (
<div
+ data-slot="status-event-content"
data-hoverable={hoverable}
className={cn(
"group -mx-3 -my-2 flex flex-col gap-2 rounded-lg border border-transparent px-3 py-2",
@@ -151,7 +157,11 @@ export function StatusEventTitle({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("font-medium", className)} {...props}>
+ <div
+ data-slot="status-event-title"
+ className={cn("font-medium", className)}
+ {...props}
+ >
{children}
</div>
);
@@ -177,7 +187,11 @@ export function StatusEventTitleCheck({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("flex items-center pl-1", className)} {...props}>
+ <div
+ data-slot="status-event-title-check"
+ className={cn("flex items-center pl-1", className)}
+ {...props}
+ >
<TooltipProvider>
<Tooltip>
<TooltipTrigger aria-label="Report resolved">
@@ -219,7 +233,11 @@ export function StatusEventAffected({
...props
}: React.ComponentProps<"div">) {
return (
- <div className={cn("flex flex-wrap gap-1", className)} {...props}>
+ <div
+ data-slot="status-event-affected"
+ className={cn("flex flex-wrap gap-1", className)}
+ {...props}
+ >
{children}
</div>
);
@@ -243,6 +261,7 @@ export function StatusEventAffectedBadge({
}: React.ComponentProps<"div">) {
return (
<Badge
+ data-slot="status-event-affected-badge"
variant="secondary"
className={cn("text-[10px]", className)}
{...props}
@@ -281,11 +300,16 @@ export function StatusEventDate({
const isFuture = date > new Date();
const distance = formatDistanceStrict(date, new Date(), { addSuffix: true });
return (
- <div className={cn("flex gap-2 lg:flex-col", className)} {...props}>
+ <div
+ data-slot="status-event-date"
+ className={cn("flex gap-2 lg:flex-col", className)}
+ {...props}
+ >
<div className="font-medium text-foreground">
{formatDate(date, { month: "short" })}
</div>{" "}
<Badge
+ data-slot="status-event-date-badge"
variant="secondary"
className={cn(
"text-[10px]",
@@ -323,7 +347,10 @@ export function StatusEventAside({
...props
}: React.ComponentProps<"div">) {
return (
- <div className="lg:-left-32 border border-transparent lg:absolute lg:top-0 lg:h-full">
+ <div
+ data-slot="status-event-aside"
+ className="lg:-left-32 border border-transparent lg:absolute lg:top-0 lg:h-full"
+ >
<div className={cn("lg:sticky lg:top-0 lg:left-0", className)} {...props}>
{children}
</div>
@@ -406,7 +433,11 @@ export function StatusEventTimelineReport({
: sortedUpdates;
return (
- <div className={cn("text-muted-foreground text-sm", className)} {...props}>
+ <div
+ data-slot="status-event-timeline-report"
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ >
{/* NOTE: make sure they are sorted by date */}
{displayedUpdates.map((update, index) => {
const updateDate = new Date(update.date);
@@ -489,7 +520,11 @@ export function StatusEventTimelineReportUpdate({
isLast?: boolean;
}) {
return (
- <div data-variant={report.status} className="group">
+ <div
+ data-slot="status-event-timeline-report-update"
+ data-variant={report.status}
+ className="group"
+ >
<div className="flex flex-row items-center justify-between gap-2">
<div className="flex flex-row gap-4">
{withDot ? (
@@ -578,7 +613,11 @@ export function StatusEventTimelineMaintenance({
// NOTE: because formatDateRange is sure to return a range, we can split it into two dates
const [from, to] = range.split(" - ");
return (
- <div data-variant="maintenance" className="group">
+ <div
+ data-slot="status-event-timeline-maintenance"
+ data-variant="maintenance"
+ className="group"
+ >
<div className="flex flex-row items-center justify-between gap-2">
<div className="flex flex-row gap-4">
{withDot ? (
@@ -594,11 +633,7 @@ export function StatusEventTimelineMaintenance({
<span>{maintenance.title}</span>{" "}
<span className="text-muted-foreground/70">·</span>{" "}
<span className="font-mono text-muted-foreground text-xs">
- <StatusTimestamp
- date={maintenance.from}
- variant="rich"
- asChild
- >
+ <StatusTimestamp date={maintenance.from} variant="rich" asChild>
<span>{from}</span>
</StatusTimestamp>
{" - "}
@@ -646,6 +681,7 @@ export function StatusEventTimelineTitle({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-event-timeline-title"
className={cn("font-medium text-foreground text-sm", className)}
{...props}
>
@@ -674,6 +710,7 @@ export function StatusEventTimelineMessage({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-event-timeline-message"
className={cn(
"py-1.5 font-mono text-muted-foreground text-sm",
className,
@@ -709,6 +746,7 @@ export function StatusEventTimelineDot({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-event-timeline-dot"
className={cn(
"size-2.5 shrink-0 rounded-full bg-muted",
"group-data-[variant=resolved]:bg-success",
@@ -745,6 +783,7 @@ export function StatusEventTimelineSeparator({
}: React.ComponentProps<typeof Separator>) {
return (
<Separator
+ data-slot="status-event-timeline-separator"
orientation="vertical"
className={cn(
"mx-auto flex-1",
diff --git a/packages/ui/src/components/blocks/status-feed.tsx b/packages/ui/src/components/blocks/status-feed.tsx
index f9da1fa7c..86e50af15 100644
--- a/packages/ui/src/components/blocks/status-feed.tsx
+++ b/packages/ui/src/components/blocks/status-feed.tsx
@@ -218,7 +218,7 @@ export function StatusFeed({
}
return (
- <StatusEventGroup {...props}>
+ <StatusEventGroup data-slot="status-feed" {...props}>
{unifiedEvents.map((event) => {
// Use stable key to prevent flicker
const key = `${event.type}-${event.id}`;
@@ -282,3 +282,4 @@ export function StatusFeed({
</StatusEventGroup>
);
}
+StatusFeed.displayName = "StatusFeed";
diff --git a/packages/ui/src/components/blocks/status-icon.tsx b/packages/ui/src/components/blocks/status-icon.tsx
index 46652e503..7c91a3ec8 100644
--- a/packages/ui/src/components/blocks/status-icon.tsx
+++ b/packages/ui/src/components/blocks/status-icon.tsx
@@ -113,6 +113,7 @@ export function StatusIcon({
return (
<div
+ data-slot="status-icon"
className={cn(
"flex items-center justify-center rounded-full bg-muted text-background",
sizeClasses,
diff --git a/packages/ui/src/components/blocks/status-layout.tsx b/packages/ui/src/components/blocks/status-layout.tsx
index e3e6a5602..2bcf2cf10 100644
--- a/packages/ui/src/components/blocks/status-layout.tsx
+++ b/packages/ui/src/components/blocks/status-layout.tsx
@@ -50,6 +50,7 @@ export function Status({
</div>
);
}
+Status.displayName = "Status";
/**
* StatusBrand - Brand logo/image component for status page headers
@@ -81,6 +82,7 @@ export function StatusBrand({
<img src={src} alt={alt} className={cn("size-8", className)} {...props} />
);
}
+StatusBrand.displayName = "StatusBrand";
/**
* StatusHeader - Header container for status page branding and title
@@ -124,6 +126,7 @@ export function StatusHeader({
</div>
);
}
+StatusHeader.displayName = "StatusHeader";
/**
* StatusTitle - Primary heading for status page
@@ -151,6 +154,7 @@ export function StatusTitle({
}: React.ComponentProps<"div">) {
return (
<div
+ data-slot="status-title"
className={cn(
"font-semibold text-foreground text-lg leading-none",
className,
@@ -161,6 +165,7 @@ export function StatusTitle({
</div>
);
}
+StatusTitle.displayName = "StatusTitle";
/**
* StatusDescription - Descriptive subtitle or secondary text
@@ -185,9 +190,12 @@ export function StatusDescription({
className,
}: React.ComponentProps<"div">) {
return (
- <div className={cn("text-muted-foreground", className)}>{children}</div>
+ <div data-slot="status-description" className={cn("text-muted-foreground", className)}>
+ {children}
+ </div>
);
}
+StatusDescription.displayName = "StatusDescription";
/**
* StatusContent - Main content area for status page components
@@ -217,8 +225,13 @@ export function StatusContent({
children,
className,
}: React.ComponentProps<"div">) {
- return <div className={cn("flex flex-col gap-3", className)}>{children}</div>;
+ return (
+ <div data-slot="status-content" className={cn("flex flex-col gap-3", className)}>
+ {children}
+ </div>
+ );
}
+StatusContent.displayName = "StatusContent";
/**
* StatusIcon - Status indicator icon wrapper for Status component context
@@ -252,3 +265,4 @@ export function StatusIcon({
<UnifiedStatusIcon variant="default" className={className} {...props} />
);
}
+StatusIcon.displayName = "StatusIcon";
diff --git a/packages/ui/src/components/blocks/status-timestamp.tsx b/packages/ui/src/components/blocks/status-timestamp.tsx
index 87d4aee60..5f4de9135 100644
--- a/packages/ui/src/components/blocks/status-timestamp.tsx
+++ b/packages/ui/src/components/blocks/status-timestamp.tsx
@@ -122,6 +122,7 @@ export function StatusTimestamp(props: StatusTimestampProps) {
return (
<RichTimestamp
+ data-slot="status-timestamp"
date={date}
side={side}
align={align}
@@ -142,11 +143,17 @@ export function StatusTimestamp(props: StatusTimestampProps) {
>;
return (
- <SimpleTimestamp date={date} className={className} {...triggerProps}>
+ <SimpleTimestamp
+ data-slot="status-timestamp"
+ date={date}
+ className={className}
+ {...triggerProps}
+ >
{children}
</SimpleTimestamp>
);
}
+StatusTimestamp.displayName = "StatusTimestamp";
/**
* SimpleTimestamp - Internal tooltip-based timestamp display
@@ -187,13 +194,14 @@ function SimpleTimestamp({
>
{children || format(new UTCDate(date), "LLL dd, y HH:mm (z)")}
</TooltipTrigger>
- <TooltipContent>
+ <TooltipContent data-slot="status-timestamp-content">
<p className="font-mono">{format(date, "LLL dd, y HH:mm (z)")}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}
+SimpleTimestamp.displayName = "SimpleTimestamp";
/**
* RichTimestamp - Internal hover card timestamp display with timezone details
@@ -275,21 +283,23 @@ function RichTimestamp({
{children}
</HoverCardTrigger>
<HoverCardContent
+ data-slot="status-timestamp-content"
className="z-10 w-auto p-2"
{...{ side, align, alignOffset, sideOffset }}
>
<dl className="flex flex-col gap-1">
- <Row value={formatted} label={timezone} />
- <Row value={utc} label="UTC" />
- <Row value={relative} label="Relative" />
+ <StatusTimestampRow value={formatted} label={timezone} />
+ <StatusTimestampRow value={utc} label="UTC" />
+ <StatusTimestampRow value={relative} label="Relative" />
</dl>
</HoverCardContent>
</HoverCard>
);
}
+RichTimestamp.displayName = "RichTimestamp";
/**
- * Row - Internal component for hover card timestamp rows
+ * StatusTimestampRow - Internal component for hover card timestamp rows
*
* Displays a single row in the rich timestamp hover card with a label (e.g., "UTC")
* and value (e.g., "Jan 15, 2024 10:30:45"). The entire row is clickable to copy
@@ -301,11 +311,18 @@ function RichTimestamp({
* @param value - The timestamp string to display and copy
* @param label - The label for this timestamp (e.g., "UTC", "PST", "Relative")
*/
-function Row({ value, label }: { value: string; label: string }) {
+function StatusTimestampRow({
+ value,
+ label,
+}: {
+ value: string;
+ label: string;
+}) {
const { copy, isCopied } = useCopyToClipboard();
return (
<div
+ data-slot="status-timestamp-row"
className="group flex items-center justify-between gap-4 text-sm"
onClick={(e) => {
e.stopPropagation();
@@ -326,3 +343,4 @@ function Row({ value, label }: { value: string; label: string }) {
</div>
);
}
+StatusTimestampRow.displayName = "StatusTimestampRow";