Meter

A visual indicator displaying a value within a known range

Installation#

npmpnpmyarnbun
npx sugarcoat add meter

Examples#

Default#

Default

With Label#

With Label

Sizes#

Available in multiple sizes.

Sizes

Colors#

Meter supports different color variants for semantic meaning.

Colors

Custom Range#

Use min and max to define custom ranges.

Custom Range

Storage Usage Example#

Storage Usage

Anatomy#

<Meter value={75}>
  <Meter.Label>Label</Meter.Label>
  <Meter.Track>
    <Meter.Indicator />
  </Meter.Track>
</Meter>

Usage#

Import
import { Meter } from "@sugarcoat/ui-nxt";
Usage
<Meter value={75} color="primary" size="md">
<Meter.Label>75% Complete</Meter.Label>
<Meter.Track>
  <Meter.Indicator />
</Meter.Track>
</Meter>

Props#

Meter (Root)#

PropTypeDefaultDescription
valuenumber-Current value of the meter
minnumber0Minimum value
maxnumber100Maximum value
size"sm" | "md" | "lg""md"Size of the meter
color"default" | "primary" | "success" | "warning" | "danger""primary"Color variant
cssSystemStyleObject-Additional CSS styles using Panda CSS syntax

Accessibility#

  • Built on Base UI Meter for robust accessibility
  • Uses role="meter" with proper ARIA attributes
  • aria-valuenow, aria-valuemin, and aria-valuemax are set automatically
  • Use Meter.Label or aria-label to provide context
Customize Theme
Build your own sugarcoat/ui theme
PresetLime / Violet / Slate
Brand ColorLime
Accent ColorViolet
Gray ScaleSlate
Border RadiusLg