Command Palette

Search for a command to run...

Docs
Progress Button

Progress Button

Button with built-in progress feedback for async operations - spinner or progress bar

Component progress-button-demo not found in registry.

Installation

Usage

import ProgressButton from "@/components/ruixen/progress-button";
 
export default function App() {
  return (
    <div className="flex gap-4">
      {/* Spinner version */}
      <ProgressButton
        label="Upload File"
        loadingLabel="Uploading..."
        successLabel="Uploaded!"
        duration={3000}
      />
 
      {/* Progress bar version */}
      <ProgressButton
        label="Process Data"
        loadingLabel="Processing..."
        successLabel="Complete!"
        showBar={true}
        duration={2000}
      />
    </div>
  );
}

Props

PropTypeDefaultDescription
labelstring-Button text in idle state
loadingLabelstring"Processing..."Text shown during loading
successLabelstring"Done!"Text shown on success
showBarbooleanfalseShow progress bar vs spinner
durationnumber2000Loading duration in ms
classNamestring-Additional CSS classes

Features

  • Two Display Modes: Spinner or progress bar
  • Three States: Idle, loading, success
  • Auto Reset: Returns to idle after success
  • Click Protection: Prevents multiple clicks during loading
  • Smooth Animations: CSS transitions for all states
  • Customizable Duration: Control loading time
  • Accessible: Proper disabled states and ARIA support

Display Modes

Spinner Mode (Default)

Shows a rotating loader icon during processing:

<ProgressButton
  label="Submit"
  showBar={false} // or omit (default)
/>

Progress Bar Mode

Shows a filling progress bar at the bottom:

<ProgressButton label="Upload" showBar={true} duration={3000} />

Use Cases

Perfect for:

  • File Uploads: Show upload progress
  • Form Submissions: API call feedback
  • Data Processing: Long-running operations
  • Payment Processing: Transaction feedback
  • Export Operations: File generation progress