0.1.0 • Published 8 months ago

react-ts-liquid-gauge v0.1.0

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

React TS Liquid Gauge component

React TS Liquid Gauge component with circle and rectangle shape. It's heavily inspired by react-liquid-gauge.

Image Image

Installation

npm install react-ts-liquid-gauge

Usage

import LiquidFillGauge from "react-ts-liquid-gauge";

function App() {
  return (
    <>
      <LiquidFillGauge
        value={70}
        waveAnimation={true}
        waveFrequency={3}
        waveAmplitude={0.5}
        gradient={true}
        riseAnimation={true}
        riseAnimationTime={1000}
        textStyle={{ fill: "#fff" }}
        waveTextStyle={{ fill: "#85ebff" }}
        shapeStyle={{ fill: "#056" }}
        waveStyle={{ fill: "#056" }}
        shapeType="rectangle"
      />
    </>
  );
}

export default App;

Props

Prop NameTypeDefaultDescription
valuenumber0The value to display in the gauge (0-100)
widthnumber200Width of the gauge
heightnumber200Height of the gauge
shapeType'circle' | 'rectangle''circle'Shape of the gauge
textSizenumber1Size multiplier for the text
textOffsetXnumber0X offset for the text position
textOffsetYnumber0Y offset for the text position
textRenderer(value: number) => string(value) => ${value}%Function to customize the displayed text
riseAnimationbooleanfalseEnable/disable rise animation
riseAnimationTimenumber2000Duration of rise animation in milliseconds
riseAnimationEasingstring'cubicInOut'Easing function for rise animation
waveAnimationbooleanfalseEnable/disable wave animation
waveFrequencynumber2Number of waves
waveAmplitudenumber1Height of waves
waveSpeednumber0.25Speed of wave animation
gradientbooleanfalseEnable/disable gradient effect
gradientStopsArray<{offset: string, color: string}>-Custom gradient stops
onClick() => voidundefinedClick handler for the gauge
textStyleReact.CSSProperties{}Style object for the text
waveTextStyleReact.CSSProperties{}Style object for the text when inside wave
shapeStyleReact.CSSProperties{}Style object for the gauge shape
waveStyleReact.CSSProperties{}Style object for the wave

License

MIT

0.1.0

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago

0.0.0

9 months ago