Progress
How far a task has come, or that it is still working.
Source
<script lang="ts">
import 'portal-bits/styles.css';
import 'portal-bits/tokens.css';
import type { Snippet } from 'svelte';
let { children }: { children: Snippet } = $props();
</script>
{@render children()}
<script lang="ts">
import ProgressExample from './ProgressExample.svelte';
</script>
<ProgressExample indeterminate={false} showValue={true} />
<script lang="ts">
import { Button, Progress } from 'portal-bits';
let {
indeterminate = false,
showValue = true,
}: { indeterminate?: boolean; showValue?: boolean } = $props();
let uploaded = $state(64);
</script>
<div class="stack">
<Progress
label={indeterminate ? 'Preparing files' : 'Uploading photos'}
value={indeterminate ? null : uploaded}
{showValue}
/>
<div class="actions">
<Button
size={32}
disabled={indeterminate}
onclick={() => (uploaded = Math.max(0, uploaded - 16))}>Back</Button
>
<Button
size={32}
variant="primary"
disabled={indeterminate}
onclick={() => (uploaded = Math.min(100, uploaded + 16))}>Advance</Button
>
</div>
</div>
<style>
.stack {
display: grid;
gap: 16px;
width: 360px;
max-width: 100%;
}
.actions {
display: flex;
gap: 8px;
}
</style>
API reference
These tables list the props and snippets that Progress declares. Attributes passed through to an element or primitive are listed under Forwarded attributes, not here.
Props
| Name | Type | Default | Required | Binding | Description |
|---|---|---|---|---|---|
label | string | None | Yes | One-way | The visible label. It names the progress bar. |
value | number | null | null | No | One-way | Progress toward `max`. `null` means indeterminate. |
max | number | 100 | No | One-way | The value that means done. |
showValue | boolean | true | No | One-way | Shows the rounded percentage beside the label. |
class | string | "" | No | One-way | Extra classes, added after the component classes. |
Forwarded attributes
None. Progress forwards no attributes.
The primitive underneath is a Bits UI peer dependency. Its own options are documented in the Bits UI Progress documentation. Only the props listed on this page are part of the Progress contract. No data attributes are documented as stable.
Limits
- The track and sweep are an adaptation. Reduced motion swaps the sweep for a slow fade.
- Values outside 0 to `max` are clamped for display.