Feedback

Status Indicator

A status you can read, rather than a color you have to guess.

OSCL StudioComponents, in context.Live preview
FOUNDATION / FEEDBACK

Status Indicator

OperationalDegradedOutageUnknown
Interactive preview. Real components.View docs

Use it in your project

Install oscl-ui from npm and import oscl-ui/styles.css once. See installation.

status-indicator-example.tsx
import { StatusIndicator } from "oscl-ui";

<StatusIndicator status="operational" />

Accessibility

Keep visible labels and keyboard focus. Supply an accessible name to icon-only actions. Try this preview with Tab, Enter, Space, and Escape where appropriate.

The source, in full

This is the actual source from the isolated OSCL package used by this website. Native props and TypeScript declarations are included in the npm package.

status-indicator.tsx
"use client";

import type { HTMLAttributes } from "react";

export interface StatusIndicatorProps extends HTMLAttributes<HTMLSpanElement> {
  status: "operational" | "degraded" | "outage" | "unknown";
}
const labels = { operational: "Operational", degraded: "Degraded", outage: "Outage", unknown: "Unknown" };
export function StatusIndicator({ status, className = "", ...props }: StatusIndicatorProps) {
  return <span {...props} className={`oscl-status oscl-status--${status} ${className}`}><span className="oscl-status-dot" aria-hidden="true" />{labels[status]}</span>;
}