Command Palette

Search for a command to run...

Docs
Status Button

Status Button

Button with animated status indicator dot for live/idle/offline states

Component status-button-demo not found in registry.

Installation

Usage

import StatusButton from "@/components/ruixen/status-button";
import { useState } from "react";
 
export default function App() {
  const [status, setStatus] = useState("offline");
 
  const handleToggle = () => {
    const statuses = ["offline", "idle", "live"];
    const currentIndex = statuses.indexOf(status);
    const nextIndex = (currentIndex + 1) % statuses.length;
    setStatus(statuses[nextIndex]);
  };
 
  return (
    <div className="space-y-4">
      <StatusButton label="Go Live" status={status} onClick={handleToggle} />
 
      <StatusButton
        label="Server Status"
        status="live"
        colors={{
          live: "bg-emerald-500",
          idle: "bg-amber-500",
          offline: "bg-red-500",
        }}
        size={16}
        pulseDuration={1.5}
      />
    </div>
  );
}

Props

PropTypeDefaultDescription
labelstring"Go Live"Button text
statusStatusType"offline"Current status
onClick() => void-Click handler
colorsRecord<StatusType, string>Default colorsCustom colors for each status
sizenumber12Status dot size in pixels
pulseDurationnumber1Pulse animation duration (s)
classNamestring-Additional CSS classes

Features

  • Animated Dot: Pulsing status indicator
  • Multiple States: Live, idle, offline, or custom
  • Custom Colors: Configurable colors for each status
  • Smooth Transitions: Animated status changes
  • Flexible Sizing: Adjustable dot size
  • Pulse Control: Customizable animation speed

Status Types

export type StatusType = "live" | "idle" | "offline" | string;

Default Colors

  • Live: bg-green-500 (Green)
  • Idle: bg-yellow-400 (Yellow)
  • Offline: bg-red-500 (Red)

Custom Status Colors

const customColors = {
  online: "bg-blue-500",
  away: "bg-orange-500",
  busy: "bg-red-600",
  offline: "bg-gray-400",
};
 
<StatusButton status="online" colors={customColors} />;

Animation

The status dot features:

  • Scale Animation: Pulses between 1x and 1.4x size
  • Opacity Animation: Fades between 0.7 and 1.0 opacity
  • Infinite Loop: Continuous pulsing animation
  • Smooth Transitions: Framer Motion powered

Use Cases

Perfect for:

  • Live Streaming: "Go Live" buttons with status
  • User Presence: Online/away/offline indicators
  • Server Status: System health indicators
  • Connection State: Network status displays
  • Recording Status: Recording/paused/stopped states