1.1.2 • Published 18 days ago

@claycot/react-7-segment-display v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
18 days ago

React 7-Segment Display

A React component that simulates a 7-segment display.

Display demo

Usage

Installation

npm install react-7-segment-display

Adding the component to your project

import { Display } from "react-7-segment-display";

const App = () => <Display value="77" />;

export default App;

Props

NameDecriptionTypeDefault value
valueValue displayed on the display (in decimal or hexadecimal)anynull
colorColor of the display segments when turned onstring"red"
heightTotal height of the display digits, in pixelsnumber250
countAmount of digits on the displaynumber2
backgroundColorColor of the background (defaults to transparent)string?n/a
skewWhether the digits are skewed or notbooleanfalse
paddingInnerPadding to use around the digitsstring"20px"
paddingOuterPadding to use around the displaystring"20px"
blankCharCharacter to display in each digit when no value providedstring"-"
leadingZeroesEnable leading zeroes for short valuesbooleantrue
rhsOnlyFirstDigitDraw the first digit as a blank or 1 onlybooleanfalse

Valid values for value

You can dislay a number in decimal or hexadecimal, giving its value by a number or a string.

Display demo

Skew prop

skew is a boolean that determines whether the digits are skewed or not. You can use it to make the display look more like a real 7-segment display.

Display demo

License

MIT License