WaterLevel

A vessel that fills with water. Two waves drift past each other, the surface sloshes when the level changes, the percentage flips to a light ink as the water passes behind it, and the water turns amber when it runs low. Data.

Open playground
31%
62 of 200 L
31%

About

WaterLevel is a React component in the Data category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { WaterLevel } from "@ashutoshswamy/smoui" and set value, max, shape among its 7 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { WaterLevel } from "@ashutoshswamy/smoui";

<WaterLevel value={62} max={200} unit="L" low={0.2} label="Rainwater tank" />
<WaterLevel value={62} max={200} shape="circle" size={120} />

Props 7

value

Current amount, 0 to max.

number
max

The full amount.

numberdefault 100
shape

Rounded tank or round flask.

"tank""circle"default "tank"
size

Width in px. A tank is 1.3 times as tall.

numberdefault 150
unit

Adds an "x of y unit" line under the vessel.

string
low

Share of full (0 to 1) below which the water turns amber.

number
label

Accessible name.

stringdefault "Water level"