Skip to main content

Starwind UI v3.0 is now available! Migration guide

Progress Primitive

Progress is a Starwind Runtime primitive in the static-semantic contract family. Astro and React share one semantic component API. React coordinates reactive state through controlled and default props plus callbacks. Astro renders initial state and coordinates later changes through DOM events and Runtime methods. Raw HTML uses Runtime attributes, DOM events, and imperative methods.

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
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 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
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.0 3 releases

v1.0.0

  • Promoted this Primitive's vendoring version to the stable 1.0.0 baseline. Its existing API and Runtime behavior carry forward from the previous release.

v0.1.1

  • Marked generated React Primitive files as client modules so vendored installs preserve client boundaries in React server frameworks.

v0.1.0

  • Introduced determinate and indeterminate progress state with accessible value metadata.