audiocn

dB Scale

Tick marks and labels for a decibel range, shared by meters and faders.

Installation

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

Usage

import { DbScale } from "@/components/ui/db-scale";
<DbScale minDb={-60} maxDb={6} />

Inside a LevelMeter or Fader, use LevelMeterScale or FaderScale instead: they take the range, orientation and taper from their parent so the ticks line up.

Anatomy

<DbScale>
  <DbScaleTick value={0} />
  <DbScaleTick value={-12} />
</DbScale>

With no children, the scale renders ticks from the ticks prop, or common values inside the range.

Examples

Vertical, with custom ticks

Theming

Data attributeOnMeaning
data-orientation, data-siderootCurrent settings
data-majorticksA major tick

Marks use bg-border and labels use text-muted-foreground.

Accessibility

The scale is decorative (aria-hidden): the meter or fader it belongs to already reports its value.

API reference

DbScale

Prop

Type

DbScaleTick

Prop

Type