New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-multi-segment-progress

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-multi-segment-progress

A React progress bar component that supports multiple segments with overlapping effect

latest
Source
npmnpm
Version
4.0.0
Version published
Maintainers
0
Created
Source

React Multi Segment Progress

Demo

"Buy Me A Coffee"

A React progress bar component that supports multiple segments with overlapping effect. Perfect for showing multiple progress states in a single bar.

Installation

npm install react-multi-segment-progress

Usage

import { MultiSegmentProgress } from "react-multi-segment-progress";

const MyComponent = () => {
  const segments = [
    { id: "completed", percentage: 30, color: "#52c41a", label: "Completed" },
    {
      id: "in-progress",
      percentage: 20,
      color: "#fa8c16",
      label: "In Progress",
    },
    { id: "pending", percentage: 50, color: "#d9d9d9", label: "Pending" },
  ];

  return (
    <MultiSegmentProgress
      segments={segments}
      height={12}
      borderRadius={6}
      backgroundColor="#f5f5f5"
      showTooltips
    />
  );
};

Props

PropTypeDefaultDescription
segmentsSegment[]requiredArray of segments to display
heightnumber12Height of the progress bar in pixels
backgroundColorstring'#E4E5E6'Background color of the progress bar
showTooltipsbooleantrueWhether to show tooltips on hover
borderRadiusnumber0Border radius of the progress bar in pixels

Segment Type

interface Segment {
  id: string; // Unique identifier for the segment
  percentage: number; // Percentage of the total width (0-100)
  color: string; // Background color of the segment
  label?: string; // Optional label for tooltip
}

Features

  • 🎨 Customizable colors and dimensions
  • 🔄 Overlapping segments with smooth transitions
  • 💡 Tooltips on hover
  • 🎯 Rounded corners support
  • 📱 Responsive design

Examples

Basic Usage

const segments = [
  { id: "1", percentage: 40, color: "#52c41a", label: "Completed" },
  { id: "2", percentage: 60, color: "#d9d9d9", label: "Remaining" },
];

<MultiSegmentProgress segments={segments} />;

With Custom Styling

const segments = [
  { id: "1", percentage: 30, color: "#722ed1", label: "Phase 1" },
  { id: "2", percentage: 45, color: "#1890ff", label: "Phase 2" },
  { id: "3", percentage: 25, color: "#13c2c2", label: "Phase 3" },
];

<MultiSegmentProgress
  segments={segments}
  height={20}
  borderRadius={10}
  backgroundColor="#f0f0f0"
/>;

Browser Support

  • Chrome
  • Firefox
  • Safari
  • Edge

License

MIT © David Arozarena

Keywords

react

FAQs

Package last updated on 17 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts