Skip to content

ProgressBar

Horizontal progress indicator with determinate and indeterminate modes. Supports semantic color variants and optional percentage display.

import { ProgressBar } from "phoundry-ui";

Determinate

Loading interactive example…

View source
determinate.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
let value = $state(65);
</script>
<div class="max-w-sm">
<ProgressBar value={65} />
</div>

Variants

Loading interactive example…

View source
variants.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
let value = $state(65);
</script>
<div class="max-w-sm space-y-3">
<ProgressBar value={100} variant="success" />
<ProgressBar value={50} variant="warning" />
<ProgressBar value={25} variant="error" />
</div>

Sizes

Loading interactive example…

View source
sizes.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
let value = $state(65);
</script>
<div class="max-w-sm space-y-3">
<div>
<span class="mb-1 block text-[10px] text-txt-tertiary">sm</span>
<ProgressBar value={60} size="sm" />
</div>
<div>
<span class="mb-1 block text-[10px] text-txt-tertiary">md</span>
<ProgressBar value={60} size="md" />
</div>
<div>
<span class="mb-1 block text-[10px] text-txt-tertiary">lg</span>
<ProgressBar value={60} size="lg" />
</div>
</div>

With Value

Loading interactive example…

View source
with-value.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
let value = $state(65);
</script>
<div class="max-w-sm space-y-3">
<ProgressBar {value} showValue />
<input type="range" min="0" max="100" bind:value class="w-full" />
</div>

Clamped values

Loading interactive example…

View source
clamped-values.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
let value = $state(65);
</script>
<p class="mb-2 text-xs text-txt-secondary">
Useful when raw progress can overshoot before you snap to complete.
</p>
<div class="max-w-sm">
<ProgressBar value={150} variant="success" showValue />
</div>

Indeterminate

Loading interactive example…

View source
indeterminate.svelte
<script lang="ts">
import { ProgressBar } from "phoundry-ui";
</script>
<div class="max-w-sm">
<ProgressBar />
</div>

API

From phoundry-ui@0.4.21

NameTypeDefaultDescription
valuenumber—0–100 for determinate progress. Omit or pass -1 for indeterminate.
variant"default" | "success" | "error" | "warning"'default'Semantic color of the progress fill.
size"sm" | "md" | "lg"'md'Bar thickness.
showValuebooleanfalseDisplay percentage text next to the bar.
classClassValue—Additional CSS classes.
stylestring—Inline styles on the stable component root.

Usage tips

  • Omit value or pass -1 for an animated indeterminate bar.
  • Use variant="success" when progress reaches 100% to reinforce completion.
  • Enable showValue for file uploads or long-running tasks where users need exact progress.

Styling

.ph-progress is the stable root hook. Consumer class values are additive, and style applies to that root. Styling uses vanilla CSS with semantic state attributes. The root emits data-size and data-variant; role="progressbar" and value attributes remain on the track. Values clamp to 0–100; omitted or negative values retain indeterminate semantics and omit aria-valuenow. Track thickness stays 0.25rem / 0.5rem / 0.75rem for sm / md / lg. Numeric progress is passed through an internal CSS property. Fill transitions use --ph-motion-slow (300ms), and indeterminate motion uses --ph-motion-progress (1800ms). Reduced motion removes both movement and transitions. Internal part selectors and --_ph-* properties remain implementation details.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.