Skip to content
iv-ui v0.3.0

Progress

since 0.2.0

Shows how much of a task is complete.

import { Progress } from '@elluzion/iv-ui';

Basic

A bar bound to a value on a 0–100 scale.

Upload
Source· svelte Show Hide
<script lang="ts">
	import { Progress } from '@elluzion/iv-ui';
</script>

<div class="field-row">
	<Progress value={42} label="Upload" />
</div>

<style>
	.field-row {
		width: 100%;
		max-width: 380px;
	}
</style>
  • Set max when the scale is not 0–100; the percentage is derived.
  • indeterminate hides the value and animates the track.
  • label names the bar; showValue prints the percentage.

Labeled

label and showValue add a header above the track.

Migration 68%
Source· svelte Show Hide
<script lang="ts">
	import { Progress } from '@elluzion/iv-ui';

	let completed = $state(68);
</script>

<div class="stack">
	<Progress value={completed} label="Migration" showValue />
	<div class="row">
		<button class="step" onclick={() => (completed = Math.max(0, completed - 10))}>−10</button>
		<button class="step" onclick={() => (completed = Math.min(100, completed + 10))}>+10</button>
	</div>
</div>

<style>
	.stack {
		display: flex;
		flex-direction: column;
		gap: var(--iv_spacing-md);
		width: 100%;
		max-width: 380px;
	}

	.row {
		display: flex;
		gap: var(--iv_spacing-sm);
	}

	.step {
		padding: var(--iv_spacing-2xs) var(--iv_spacing-sm);
		border: 1px solid var(--iv_border);
		border-radius: var(--iv_radius-sm);
		background: var(--iv_surface-raised);
		color: var(--iv_foreground);
		font-family: var(--iv_font-mono);
		font-size: var(--iv_text-sm);
		cursor: pointer;
	}
</style>

Indeterminate

Use when progress is unknown but the work is running.

Waiting for the runner
Source· svelte Show Hide
<script lang="ts">
	import { Progress } from '@elluzion/iv-ui';
</script>

<div class="field-row">
	<Progress indeterminate label="Waiting for the runner" />
</div>

<style>
	.field-row {
		width: 100%;
		max-width: 380px;
	}
</style>

Sizes

sm for dense rows and md for page-level progress.

Small 30%
Medium 30%
Source· svelte Show Hide
<script lang="ts">
	import { Progress } from '@elluzion/iv-ui';
</script>

<div class="stack">
	<Progress value={30} size="sm" label="Small" showValue />
	<Progress value={30} label="Medium" showValue />
</div>

<style>
	.stack {
		display: flex;
		flex-direction: column;
		gap: var(--iv_spacing-lg);
		width: 100%;
		max-width: 380px;
	}
</style>
import { Progress } from '@elluzion/iv-ui';

Props

7 props · 0 events · 0 snippets
PropTypeDefaultDescription
value number0Current progress value.
max number100Value that represents completion.
indeterminate booleanfalseRenders an animated unknown-progress state.
label string''Visible label and accessible name.
showValue booleanfalseShows the percentage at the end of the track.
size 'sm' | 'md''md'Track thickness.
className string''Extra classes merged onto the root element.

class, id, style, aria-*, and data-* are forwarded through rest props.

KeysAction
EscapeNot applicable; the bar is read-only.
  • The bar uses role="progressbar" with aria-valuemin, aria-valuemax, and aria-valuenow.
  • Indeterminate bars omit the value and use aria-valuetext="Indeterminate".
  • label becomes the accessible name through aria-labelledby.
Class hooks
.iv-fill.iv-fill-wrap.iv-indeterminate.iv-label.iv-progress.iv-progress-header.iv-sm.iv-track.iv-value
iv-ui
↑ ↓ navigate ↵ open esc close minisearch · 482 records