Confidence Meter

How sure a model is, in five steps. Segmented on purpose — a smooth bar invites reading 0.834 as different from 0.851, which is not what a calibration score supports.

src/components/ui/confidence-meter.tsx

About

From the component's own source, where it was written.

A model's confidence in an answer.

Segmented rather than continuous, deliberately. A smooth bar invites reading 0.834 as meaningfully different from 0.851, which is not what a calibration score supports. Five steps say "fairly confident" and stop there.

The band label is the accessible name, so a screen reader hears "confidence: high" instead of a percentage that implies more precision than exists.

Install

npx astralyx-ui add confidence-meter

Usage

import { ConfidenceMeter } from '@/components/ui/confidence-meter'

<ConfidenceMeter value={0.82} />

Composer

Change the props and the source below follows.

ConfidenceHigh
Props
tsx
<ConfidenceMeter value={0.75} showLabel={true} />

Examples

Bands

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

ConfidenceMeter

A model's confidence in an answer.

Extends Omit<ComponentProps<'div'>, 'children'>.

PropTypeDefaultDescription
valuenumberrequired0 to 1. Mapped to one of five bands.
labelReactNode'Confidence'The band name is the accessible value too — a screen reader hears "high", not a percentage implying more precision than exists.
showLabelbooleantrueThe band name is the accessible value too — a screen reader hears "high", not a percentage implying more precision than exists.
hintReactNode——
size'sm' | 'default''default'Segment height.
rolemeter—With aria-valuetext set to the band, since this is a measurement within a range rather than task progress.