Progress
@codeui/solid v0.3.0
A bar that shows how much of a task is done.
When to use
Use Progress for exports with a known frame count or another task whose completion you can measure.
When to choose another component
Use Spinner for compact activity with no known total. Use Skeleton for the shape of content that has not loaded.
Live demo
import { Progress } from "@codeui/solid";
export default function Demo() {
return <Progress label="Export frames" value={40} showValue />;
}Anatomy
Tap a part to outline it in the demo.
- 01Fill
progress-fillclasses.fill - 02Label
progress-labelclasses.label - 03Root
progressclasses.root - 04Track
progress-trackclasses.track - 05ValueLabel
progress-value-labelclasses.valueLabel
| Export | Renders | classes key | data-cui | Role |
|---|---|---|---|---|
Fill | div | fill | progress-fill | None |
Label | span | label | progress-label | None |
Root | div | root | progress | progressbar |
Track | div | track | progress-track | None |
ValueLabel | div | valueLabel | progress-value-label | None |
Variants
Sizes
import { Progress, Stack } from "@codeui/solid";
export default function Demo() {
return (
<Stack gap="3">
<Progress label="PNG export" size="sm" value={40} showValue />
<Progress label="Video export" size="md" value={60} showValue />
</Stack>
);
}sm is the default track height. md makes the track taller. Progress has no tone or appearance variants.
States
import { Progress, Stack } from "@codeui/solid";
import * as P from "@codeui/solid/progress/parts";
export default function Demo() {
return (
<Stack gap="3">
<Progress label="Queued frames" value={0} showValue />
<Progress label="Export frames" value={60} showValue />
<Progress label="Export complete" value={100} showValue />
<P.Root indeterminate>
<P.Label>Preparing export</P.Label>
<div class={P.progressStyles.valueLabel()}>Preparing…</div>
<P.Track>
<P.Fill />
</P.Track>
</P.Root>
</Stack>
);
}value defaults to 0 in the range 0 to 100. minValue and maxValue define another range. indeterminate shows unknown completion. getValueLabel formats the value text. Kobalte leaves ValueLabel empty while indeterminate and does not call getValueLabel. The parts example renders a separate styled value label with “Preparing…” instead of a percentage.
Ready API
Progress
Progress renders an optional Label, an optional ValueLabel, and Track with Fill. showValue defaults to false. Name the progressbar with label, aria-label, or aria-labelledby.
Prop
Type
Inherited behavior from Kobalte progress.
Prop
Type
Styled parts API
Import the parts from @codeui/solid/progress/parts. The root wraps Kobalte progress.
Fill
Styled Kobalte Fill. Its width follows the root value.
Prop
Type
Label
Styled Kobalte Label associated with the progressbar.
Prop
Type
Root
Styled Kobalte Root. It owns value, range, and indeterminate state.
Prop
Type
Prop
Type
Track
Styled Kobalte Track around Fill.
Prop
Type
useProgressContext
Re-exported from Kobalte. Call it inside Root to read the current value, percentage, formatted label, fill width, and state dataset in a custom child. It does not render an element or accept component props.
ValueLabel
Styled Kobalte ValueLabel with tabular numbers.
Prop
Type
ProgressParts groups Root, Label, Track, Fill, and ValueLabel. The same namespace is available from @codeui/solid.
Styles export
progressStyles
progressStyles is typed as ProgressStyles. Each function returns its part class. Set data-size="md" on a custom track for the medium size. Import the helpers from @codeui/solid or @codeui/solid/progress/parts.
Accessibility
Keyboard
Progress is non-interactive and has no keyboard commands. It does not add a tab stop.
ARIA
Root renders role="progressbar" with aria-valuemin and aria-valuemax. Determinate progress includes aria-valuenow and formatted aria-valuetext. Indeterminate progress omits both value attributes. Label connects through aria-labelledby. ValueLabel is visual output, not a live announcement of each update.
Focus
Mounting or removing the component does not move focus. There is no open or close focus cycle. The containing control or application owns focus.
Reduced motion
Determinate Fill follows the value without a transition. Indeterminate Fill spans the track and pulses its opacity. Under prefers-reduced-motion: reduce, the pulse stops and the full-width fill stays visible. The bar remains indeterminate.
SSR notes
The component renders inline on the server. It has no portal or client-only effect. Use the same initial props on the server and client. Kobalte generates IDs for the label relationship. Keep the component tree stable through hydration.
Theming hooks
The component reads these theme variables.
--cui-action-brand-base--cui-font-size-caption--cui-motion-duration-slow--cui-motion-ease-out--cui-radius-full--cui-space-1--cui-space-2--cui-surface-input-accent--cui-text-default--cui-text-hint--cui-text-label
Kobalte also provides --kb-progress-fill-width for determinate width.
Defaults come from the kit theme. See Color, Typography, Space and shape, and Motion.
Composition examples
import * as P from "@codeui/solid/progress/parts";
export default function Demo() {
return (
<P.Root
value={12}
maxValue={24}
getValueLabel={({ value, max }) => `${value} of ${max} frames`}
>
<P.Label>Export frames</P.Label>
<P.ValueLabel />
<P.Track>
<P.Fill />
</P.Track>
</P.Root>
);
}The parts example uses a 24-frame range and formats the visible value and accessible value text through getValueLabel. Do not present an invented percentage for indeterminate work.
Related
Use Spinner for compact activity with no known total. Use Skeleton for the shape of content that has not loaded.