Default
import { PixelProgress } from '@pxlkit/ui-kit';
export function Default() {
return <PixelProgress value={60} label="HP" />;
}Determinate or indeterminate progress bar that renders as 10 segmented HP-bar blocks on the pixel surface and a smooth filled track on the linear surface.
import { PixelProgress } from '@pxlkit/ui-kit';| Prop | Type | Default | Description |
|---|---|---|---|
value (required) | number | — | Current value 0-100 (clamped). |
tone | 'green' | 'cyan' | 'gold' | 'red' | 'purple' | 'pink' | 'neutral' | 'green' | Tone determines fill color. Defaults to 'green'. |
label | string | — | Optional label rendered above the bar. Also used as the progressbar's accessible name; falls back to "Progress" when omitted. |
showValue | boolean | true | Whether to show the numeric percentage on the right. Defaults to true. |
surface | 'pixel' | 'linear' | — | Surface override; falls back to nearest provider. |
indeterminate | boolean | false | Unknown-duration work: the bar pulses (it holds still, at 70 %, for a reader who prefers reduced motion), aria-valuenow is dropped and aria-busy set. |
ref points to <div>.
WCAG target: 2.1 AA
progressbarExposes role="progressbar" with aria-valuemin=0 and aria-valuemax=100; aria-valuenow is set from the clamped value. The label prop is forwarded to aria-label, falling back to "Progress" when omitted so the progressbar always has an accessible name. In indeterminate mode aria-valuenow is omitted and aria-busy is set to true so assistive tech announces unknown-duration work; the bar pulses only for a reader who allows motion, and under prefers-reduced-motion: reduce holds still at 70 % opacity. The 10-segment pixel surface is purely visual — assistive tech reads the same progressbar attributes as the linear surface.
import { PixelProgress } from '@pxlkit/ui-kit';
export function Default() {
return <PixelProgress value={60} label="HP" />;
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Default() {
return <PixelProgress value={60} label="HP" />;
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Tones() {
return (
<div className="space-y-3">
<PixelProgress value={70} tone="neutral" label="Neutral" />
<PixelProgress value={70} tone="green" label="Green" />
<PixelProgress value={70} tone="cyan" label="Cyan" />
<PixelProgress value={70} tone="gold" label="Gold" />
<PixelProgress value={70} tone="red" label="Red" />
<PixelProgress value={70} tone="purple" label="Purple" />
<PixelProgress value={70} tone="pink" label="Pink" />
</div>
);
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Surfaces() {
return (
<div className="space-y-4">
<PixelProgress value={55} label="Pixel (segmented)" surface="pixel" />
<PixelProgress value={55} label="Linear (smooth)" surface="linear" />
</div>
);
}import { PixelProgress } from '@pxlkit/ui-kit';
export function WithoutValue() {
return <PixelProgress value={45} label="Loading assets" showValue={false} />;
}import { PixelProgress } from '@pxlkit/ui-kit';
export function WithoutLabel() {
return <PixelProgress value={80} />;
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Indeterminate() {
return <PixelProgress value={0} label="Working…" indeterminate />;
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Clamped() {
return (
<div className="space-y-3">
<PixelProgress value={-25} label="Below 0 (clamped to 0)" />
<PixelProgress value={150} label="Above 100 (clamped to 100)" />
</div>
);
}import { PixelProgress } from '@pxlkit/ui-kit';
export function Steps() {
return (
<div className="space-y-3">
<PixelProgress value={0} label="0%" />
<PixelProgress value={25} label="25%" />
<PixelProgress value={50} label="50%" />
<PixelProgress value={75} label="75%" />
<PixelProgress value={100} label="100%" />
</div>
);
}