Skip to content
Primitives

Status Dot

Online/away/busy/offline presence indicator — the natural complement to Avatar.

Motionoptional CSS pulse (animate-ping) for live presence

Install

Install Kineto and follow the theme setup once in your app.

bash
npm install kineto
tsx
import { StatusDot } from "kineto/status-dot";

Preview

online
away
busy
offline
SK
tsx
import * as React from "react";

import { cn } from "@/lib/cn";

export type PresenceStatus = "online" | "away" | "busy" | "offline";

const statusColor: Record<PresenceStatus, string> = {
  online: "bg-success",
  away: "bg-warning",
  busy: "bg-destructive",
  offline: "bg-muted-foreground/50",
};

const statusLabel: Record<PresenceStatus, string> = {
  online: "Online",
  away: "Away",
  busy: "Busy",
  offline: "Offline",
};

const sizeClass = {
  sm: "size-2",
  md: "size-2.5",
  lg: "size-3",
} as const;

export interface StatusDotProps extends React.HTMLAttributes<HTMLSpanElement> {
  status?: PresenceStatus;
  size?: keyof typeof sizeClass;
  /** Animate a soft pulse (good for "online" / live presence). */
  ping?: boolean;
  /** Add a ring in the surface color — use when overlaying on an avatar so it reads as separate. */
  ring?: boolean;
  /** Accessible label; defaults to the capitalized status. */
  label?: string;
}

/**
 * Presence indicator — the natural complement to `Avatar`. Use standalone, or overlay it on an
 * avatar (wrap the avatar in a `relative` element and absolutely position the dot, `ring` on).
 * The pulse is pure CSS, so this stays a presentational, server-renderable primitive.
 */
const StatusDot = React.forwardRef<HTMLSpanElement, StatusDotProps>(
  ({ className, status = "offline", size = "md", ping = false, ring = false, label, ...props }, ref) => (
    <span
      ref={ref}
      role="status"
      aria-label={label ?? statusLabel[status]}
      className={cn("relative inline-flex shrink-0", sizeClass[size], className)}
      {...props}
    >
      {ping ? (
        <span
          aria-hidden="true"
          className={cn(
            "absolute inline-flex h-full w-full animate-ping rounded-full opacity-75",
            statusColor[status]
          )}
        />
      ) : null}
      <span
        className={cn(
          "relative inline-flex h-full w-full rounded-full",
          statusColor[status],
          ring && "ring-2 ring-background"
        )}
      />
    </span>
  )
);
StatusDot.displayName = "StatusDot";

export { StatusDot };

src/components/ui/status-dot.tsx

Props

PropTypeDefaultDescription
status"online" | "away" | "busy" | "offline""offline"Presence state → dot color.
size"sm" | "md" | "lg""md"Dot size.
pingbooleanfalseAnimate a soft pulse (good for live/online).
ringbooleanfalseAdd a surface-colored ring when overlaying on an avatar.
labelstring—Accessible label; defaults to the capitalized status.