Progress

A native <progress> bar.

progress-demo.tsx
import { Progress } from './ui/progress.tsx'

export default () => <Progress value="66" aria-label="Upload" style="max-width: 20rem" />

Installation

dui add progress

Or copy ui/progress.tsx and ui/progress.css into your project, with lib/jsx/jsx-runtime.ts, lib/jsx/jsx-dev-runtime.ts, lib/css.d.ts, and lib/theme.css.

Examples

With Datastar

40%

Also uses Button.

progress-datastar.tsx
import { Button } from './ui/button.tsx'
import { Progress } from './ui/progress.tsx'

// data-attr:value moves the bar as the signal changes.
export default () => (
  <div data-signals:done="40" style="display: grid; gap: 1rem; width: 100%; max-width: 20rem">
    <Progress value="40" data-attr:value="$done" aria-label="Done" />
    <div style="display: flex; gap: 0.5rem">
      <Button size="sm" variant="outline" data-on:click="$done = Math.max(0, $done - 20)">
        − 20
      </Button>
      <Button size="sm" variant="outline" data-on:click="$done = Math.min(100, $done + 20)">
        + 20
      </Button>
      <span data-text="$done + '%'" style="margin-left: auto">
        40%
      </span>
    </div>
  </div>
)

Indeterminate

progress-indeterminate.tsx
import { Progress } from './ui/progress.tsx'

// Without a value, it's indeterminate: the browser shows it as busy.
export default () => <Progress aria-label="Loading" style="max-width: 20rem" />

Compared to shadcn/ui