audiocn

dB Readout

A numeric level label that updates at a readable rate and never shifts the layout.

Peak−∞ dBRMS−∞ dBPeak, held 1 s−∞ dBValue−6.0 dB

Installation

$ pnpm dlx shadcn@latest add @audiocn/db-readout

Usage

import { DbReadout } from "@/components/ui/db-readout";
<DbReadout source={analyser.meter} />

With a source, the readout updates its own text four times a second without re-rendering React. Its width is reserved for the longest value, so the text never pushes neighbouring elements around.

Examples

Color by zone

The readout sets data-zone and data-silent, so it can change color with plain Tailwind classes.

−∞ dB

Theming

Data attributeMeaning
data-zoneok, warn or clip
data-silentThe level is at or below floorDb

API reference

Prop

Type