Progress

new

A progress bar with Nuxt UI's indeterminate animations, status, steps and seven sizes, and shadcn's label and value.

Demo

Open Props in the corner of the example to try color and size. color takes Button's colours or your own, primary by default. The bar, its track at 20% and the step names are drawn in the colour's text shade, which stays readable on the page where a bright success or warning wouldn't; all three follow the root's text colour, so class="text-foreground" still recolours them.

2xs to 2xl set the thickness from 1 to 20px, and the size of the status and step text. md is the default.

Installation

Usage

<script setup lang="ts">
import { Progress } from '@/components/ui/progress'

const value = ref(40)
</script>

<template>
  <Progress v-model="value" />
</template>

The API is Nuxt UI's Progress, without ui: the parts are styled through their data-slot.

Examples

Indeterminate

Without a value, or with null, the bar is indeterminate and animated. animation picks the movement: carousel (the default), carousel-inverse, swing or elastic. The carousels run the other way in right-to-left, as the fill grows from the right, and every animation becomes a slow pulse under reduced motion. The bar takes the direction from Reka's ConfigProvider and renders it as its own dir; <html dir="rtl"> alone is not read, so a right-to-left app wraps itself in ConfigProvider dir="rtl".

Animations
carousel
carousel-inverse
swing
elastic

Status

status shows the percentage above the bar, where the fill ends. Replace it through the status slot, which receives percent.

Status
30%
70%

Steps

An array as max gives the bar one step per item: the value is the index of the current step, and its name shows under the bar. Replace a step's name through its step-<index> slot, which receives step.

Steps
50%
Waiting…
Cloning…
Migrating…
Deploying…
Done!

Orientation

orientation="vertical" fills the height of the container from the top; inverted fills either orientation from the other end.

Vertical progress
25%
50%
75%

Label and value

ProgressLabel and ProgressValue go in the default slot and sit in a row above the bar. The label names the bar for screen readers. The value shows the percentage and is hidden from screen readers, since the bar already reports its value; its slot receives percent, value and max.

With a label
Upload progress

API Reference

Data attributes

data-slotAttributesDescription
progressdata-color, data-orientation, data-sizeThe root.
progress-header—The row around the default slot, rendered only when it is used.
progress-status—The percentage shown by status.
progress-trackdata-state, data-value, data-maxThe track, with role="progressbar". data-state is indeterminate, loading or complete.
progress-indicatordata-stateThe fill.
progress-steps—The step names under the bar.
progress-stepdata-stateOne step name. data-state is active or first for the current step, other for the rest.
progress-label—The label.
progress-value—The percentage beside the label.

Changelog

  1. registry 0.22.0

    676e751 — Progress clamps a value outside 0 to max before Reka sees it, so a float overshoot such as 100.4 shows a full bar instead of Reka rewriting the model to null, and aria-valuenow never passes aria-valuemax. NaN shows an indeterminate bar.

    1b1de29 — Progress renders the ConfigProvider direction as its root's dir, so the determinate fill and the indeterminate animations read one source: before, <html dir="rtl"> without a ConfigProvider mirrored the carousel while the fill still grew from the left. Such an app now gets a left-to-right bar in both modes; wrap the app in ConfigProvider dir="rtl".

  2. core 0.16.0

    c2b5813 — Progress in a right-to-left document: the swing and elastic animations stay inside the track, mirrored, instead of sliding off its edge, and under reduced motion the carousel and carousel-inverse animations pulse like the others instead of sliding.

  3. registry 0.13.0

    5a478d3 — Checkbox, Radio, Switch, Slider, Progress, Stepper and TabsList take color: primary (the default), neutral, destructive, success, warning, info, or any name you declare on [data-slot][data-color="<name>"], as on Button. The root carries data-color. Whatever they draw straight on the page takes the colour's --tone-text: a checked edge, the radio's dot, the default slider's range and thumb, the progress bar and the tab line. That keeps a bright success, warning or info at 3:1 against the page. Fills with something on them, like the checked box, the switch track and the active step, keep --tone. On the choice controls the unchecked edge stays --input and an invalid control still turns destructive. Keyboard focus rings a control in a colour other than primary in its --tone-text, red once it's invalid. CheckboxGroup and RadioGroup pass their color to every control in them without one, and ChoiceGroup takes color for the selected card's edge, the focused card's ring and the selected row's tint. Switch, Checkbox, Radio and Slider now set data-size, md by default. They need the @kappa-ui/core release that lets tone-control follow data-color.

    Recoloured Switch, Checkbox, Radio or Slider with class="[--tone:…] [--tone-foreground:…]", as the theming page used to suggest? Their edges and marks now read --tone-text, so add [--tone-text:…] to the class, or use color.

  4. registry 0.3.0

    95f4d61 — Add Progress, ported from Nuxt UI, with shadcn's ProgressLabel and ProgressValue. Core gains the animate-progress-* utilities it animates with.

  5. core 0.3.0

    95f4d61 — Add Progress, ported from Nuxt UI, with shadcn's ProgressLabel and ProgressValue. Core gains the animate-progress-* utilities it animates with.