Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Progress Primitive

Progress is a Starwind Runtime primitive in the static-semantic contract family.

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>

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
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 Intl.NumberFormatOptions -
Description
Configures the format option for the Root part.
Kind
option
Targets
-
Full type
Intl.NumberFormatOptions
getAriaValueText (formattedValue: string | null, value: ProgressValue) => string -
Description
Configures the get aria value text option for the Root part.
Kind
option
Targets
-
Full type
(formattedValue: string | null, value: ProgressValue) => string
locale Intl.LocalesArgument -
Description
Sets the locale used by Progress.
Kind
option
Targets
-
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
State control support
React supports controlled state with the value prop. Runtime/HTML reads initial state from data-value and updates with setValue. Astro adapters render initial/default state, but do not expose reactive controlled-state props for this state.

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