1.0.1 • Published 8 months ago

react-custom-gradient-progress-bar v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Gradient Progress Bar

A highly customizable, accessible Gradient Progress Bar component for React applications.

Features

  • 🌈 Customizable Gradient effect
  • 🎨 Custom color schemes support
  • ⌨️ Keyboard accessibility
  • 📱 Touch device support
  • ♿ ARIA compliant
  • 🎯 Custom min/max/step values
  • 💫 Smooth animations
  • 🎈 Tooltip support
  • 📝 Custom value formatting
  • 🔄 Loading state
  • 🚫 Disabled state
  • 📦 TypeScript support

Installation

npm install react-custom-gradient-progress-bar
# or
yarn add react-custom-gradient-progress-bar

Usage

import { GradientProgressBar } from 'react-custom-gradient-progress-bar';

function App() {
  return (
    <GradientProgressBar
      initialValue={50}
      min={0}
      max={100}
      step={5}
      onChange={(value) => console.log(`Value changed: ${value}`)}
    />
  );
}

Props

PropTypeDefaultDescription
initialValuenumber0Initial value of the progress bar
minnumber0Minimum value
maxnumber100Maximum value
stepnumber1Step increment for keyboard navigation
disabledbooleanfalseDisables the progress bar
loadingbooleanfalseShows loading state
colorsColorConfigGradient presetCustom color configuration
formatValue(value: number) => string(v) => ${v}%Custom value formatter
onChange(value: number) => voidundefinedChange callback
classNamestringundefinedAdditional CSS classes
styleCSSPropertiesundefinedAdditional inline styles

ColorConfig Type

interface ColorConfig {
  colors: string[];  // Array of colors for gradient
  angle?: number;    // Gradient angle in degrees
}

Keyboard Navigation

  • ←/↓: Decrease value by step
  • →/↑: Increase value by step
  • Home: Set to minimum value
  • End: Set to maximum value

Examples

Custom Colors

<GradientProgressBar
  colors={{
    colors: ['#ff0000', '#00ff00', '#0000ff'],
    angle: 45
  }}
/>

Custom Formatting

<GradientProgressBar
  formatValue={(value) => `${value} points`}
/>

With Loading State

<GradientProgressBar
  loading={true}
/>

License

MIT © Farhan Tafader