Skip to main content

Starwind UI v3.7 is here with stable Vue and Svelte, the new Chart component, and full RTL support. Read the release notes

Progress Primitive

Use Progress to show how much of a task has finished. It updates the indicator as the value changes and supports tasks with an unknown total.

Uploading files

Anatomy

Use the Astro primitive adapter to render Progress anatomy with the Runtime wiring included.

---
import { Progress } from "@starwind-ui/astro/progress";
---
<Progress.Root>
<Progress.Label>Upload progress</Progress.Label>
<Progress.Track>
<Progress.Indicator />
</Progress.Track>
<Progress.Value>Selected value</Progress.Value>
</Progress.Root>

Astro, React, Vue, and Svelte components use the same underlying interactions. Each framework has its own way to read and update state. See the examples and your installed packageโ€™s types for the available props and events. Plain HTML uses DOM events and Runtime methods.

API Reference

Root

The main element that owns the Progress Runtime instance.

Default element
div
Discovery hook
data-sw-progress
Role
progressbar

Props

Prop Type Default Toggle
value number | null null
Description
Controls the current Progress value.
Kind
control
Targets
-
Full type
number | null
React

Use value for controlled state.

  • value
Astro

Use value for initial state and call setValue for later updates.

  • value
  • setValue
Runtime / HTML

Use data-value for initial state and call setValue for later updates.

  • data-value
  • setValue
max number 100
Description
Configures the max option for the Root part.
Kind
option
Targets
-
Full type
number
min number 0
Description
Configures the min option for the Root part.
Kind
option
Targets
-
Full type
number
format React, Vue, Svelte only Intl.NumberFormatOptions -
Description
Configures the format option for the Root part.
Kind
option
Targets
-
Frameworks
React, Vue, Svelte
Full type
Intl.NumberFormatOptions
getAriaValueText React, Vue, Svelte only (formattedValue: string | null, value: ProgressValue) => string -
Description
Configures the get aria value text option for the Root part.
Kind
option
Targets
-
Frameworks
React, Vue, Svelte
Full type
(formattedValue: string | null, value: ProgressValue) => string
locale React, Vue, Svelte only Intl.LocalesArgument -
Description
Sets the locale used by Progress.
Kind
option
Targets
-
Frameworks
React, Vue, Svelte
Full type
Intl.LocalesArgument

State

State Type Props Toggle
value ProgressValue value
Description
Tracks the current Progress value.
Initial attribute
data-value
Runtime getter
getValue
Runtime setter
setValue
React

Use value for controlled state.

  • value
Astro

Use value for initial state and call setValue for later updates.

  • value
  • setValue
Runtime / HTML

Use data-value for initial state and call setValue for later updates.

  • data-value
  • setValue

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-progress - Marks the Root part so Starwind Runtime can find it.
State
Attribute Value Description
data-value - Reflects the value state on the Root part.
data-indeterminate - Reflects the indeterminate state on the Root part.
Metadata
Attribute Value Description
data-min - Reflects the min prop on the Root part.
data-max - Reflects the max prop on the Root part.

Track

The track that contains the Progress range.

Default element
div
Discovery hook
data-sw-progress-track
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-progress-track - Marks the Track part so Starwind Runtime can find it.

Indicator

Visual state indicator rendered by Progress.

Default element
div
Discovery hook
data-sw-progress-indicator
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-progress-indicator - Marks the Indicator part so Starwind Runtime can find it.

Value

Displays the current Progress value.

Default element
span
Discovery hook
data-sw-progress-value
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-progress-value - Marks the Value part so Starwind Runtime can find it.
Metadata
Attribute Value Description
data-preserve-text - Reflects the preserve text prop on the Value part.

Label

Text label associated with Progress.

Default element
span
Discovery hook
data-sw-progress-label
Role
-

Data Attributes

Runtime hooks
Attribute Value Description
data-sw-progress-label - Marks the Label part so Starwind Runtime can find it.

Runtime API

Factory
createProgress
Import
@starwind-ui/runtime/progress
Root hook
root data-sw-progress
Option props
format, getAriaValueText, locale, max, min, value

Option Lifecycles

OptionLifecycle
formatsetter-backed
getAriaValueTextsetter-backed
localesetter-backed
maxsetter-backed
minsetter-backed
valuesetter-backed

Runtime Setters

Method Target Description
setFormatOptions props: format, getAriaValueText, locale Updates Progress formatting options from Runtime code.
setValue props: value, max, min Updates the current Progress value from Runtime code.
Component Relationship
Progress Direct primitive

Changelog

View version history v1.0.4 7 releases

v1.0.4

  • In Vue, this component now needs Vue 3.5.21 or newer.

v1.0.3

  • In Astro, an attribute that you set on a Progress part now wins over the part's own default for the same attribute, such as `role` or `aria-label`.

v1.0.2

  • Internal maintenance. No change to how the component behaves.
  • Reduced repeated JavaScript when Astro Progress is used with other Starwind components.

v1.0.1

  • Removed old comments from the Vue Primitive files that said the code was internal and not for release. The CLI also removes the blank line that these comments left in the Vue Primitive `index.ts` files that it copies into your project.

v1.0.0

  • This Primitive is now stable at version `1.0.0`. Its API and behavior stay the same as in the previous release.

v0.1.1

  • The React Primitive files that the CLI copies into your project are now marked with `"use client"`, so they stay client components in React server frameworks.

v0.1.0

  • First release. Progress shows a set value or an indeterminate state, and it gives its value to screen readers.