This browser is not supported. The glass needs a Chromium browser or Electron. Why

ProgressView

A bar when there is a value, a spinner when there isn't. Flat, as on iOS: no glass.

import { ProgressView } from "@adamexu/glass";

Bar

With a value it is a bar, filled to value / total: the label (children) goes over it, currentValueLabel under it. A bar's value changes in a step, never animated, as SwiftUI's does even under withAnimation. progressViewStyle="linear" without a value is an empty, still track.

Downloading40%
const [progress, setProgress] = useState(0.4);

<ProgressView value={progress} currentValueLabel={`${Math.round(progress * 100)}%`}>
  Downloading
</ProgressView>
<ProgressView value={7} total={10} tint="#34C759" aria-label="Storage" />
<ProgressView progressViewStyle="linear" aria-label="Waiting" />
<Button buttonStyle="plain" onClick={() => setProgress((p) => (p > 0.5 ? 0.2 : 0.8))}>
  Change the bar
</Button>

Spinner

Without a value it spins. Spinners are 14 px (mini, small), 20 (regular) or 37 (large, extraLarge), with the label centered under them. The spinner is 16 frames stepped on the compositor, so it keeps time while the main thread is busy.

Loading
<ProgressView controlSize="small" />
<ProgressView />
<ProgressView controlSize="large" />
<ProgressView tint="#FF2D55">Loading</ProgressView>

In a List

Each one is its own row. While a presentation (an alert, a sheet, a pop-up) is up, a bar's fill goes gray, as UIKit dims its tints.

const [progress, setProgress] = useState(0.4);

<NavigationStack
  root={
    <NavigationPage title="Downloads">
      <List>
        <Section header="Progress">
          <ProgressView />
          <ProgressView>Loading</ProgressView>
          <ProgressView value={progress} />
          <ProgressView value={progress} currentValueLabel={`${Math.round(progress * 100)}%`}>
            <Text>Downloading</Text>
          </ProgressView>
          <Button buttonStyle="plain" onClick={() => setProgress((p) => (p > 0.5 ? 0.2 : 0.8))}>
            Change the bar
          </Button>
        </Section>
      </List>
    </NavigationPage>
  }
/>

Props

PropTypeDefaultDescription
valuenumber | null-null or left out: indeterminate.
totalnumber1The value that fills the bar.
progressViewStyle"automatic" | "circular" | "linear""automatic"automatic: a bar with a value, a spinner without. circular always spins; linear without a value is an empty, still track.
controlSize"mini" | "small" | "regular" | "large" | "extraLarge""regular"Spinners only: 14 px (mini, small), 20, 37 (large, extraLarge).
tintstring-A bar's fill, a spinner's blades.
childrenReactNode-The label: under a spinner (centered, secondary), over a bar.
currentValueLabelReactNode-Under a bar.
disabledbooleanfalseAccepted and ignored: .disabled doesn't change a ProgressView.
aria-labelstring-On the role="progressbar" element; a string label names it otherwise.
className, stylestring, CSSProperties-On the same element.

Accessibility

It is a role="progressbar". A bar has aria-valuenow, aria-valuemin 0 and aria-valuemax total; a spinner is aria-busy and named "Loading" unless labelled.

SwiftUI

SwiftUI@adamexu/glass
ProgressView()<ProgressView />
ProgressView(value:, total:) { label } currentValueLabel: { }<ProgressView value total currentValueLabel>label</ProgressView>
.progressViewStyle(.circular / .linear)progressViewStyle="circular" / "linear"
.controlSize(.small / .large)controlSize="small" / "large"
.tint(c)tint={c}