Feedback

Progress bar

A progress bar with its label and percentage, or a sliding bar when the progress is unknown.

JxProgress import 'package:jx_cli/ui.dart' Available since 0.0.2

Preview

Upload64%
Profile completed60%

When to use it

  • File uploads.
  • Storage or quota usage.
  • Steps completed in an onboarding.

States

Storage
Without the value
Preparing the export
Indeterminate

Minimal example

Dart
JxProgress(value: 64, label: 'Upload')

Complete example

A full Jaspr component you can paste into a project.

Dart
import 'package:jaspr/jaspr.dart';
import 'package:jx_cli/ui.dart';

class StorageUsage extends StatelessComponent {
  const StorageUsage({required this.usedGb, required this.totalGb, super.key});

  final double usedGb;
  final double totalGb;

  @override
  Component build(BuildContext context) {
    return JxProgress(
      value: usedGb,
      max: totalGb,
      label: '${usedGb.toStringAsFixed(1)} GB of ${totalGb.toStringAsFixed(0)} GB',
    );
  }
}

Properties

Property Type Default Description
value num? null Current value, clamped between 0 and max . null : indeterminate.
label String required Visible label and accessible name.
max num 100 Value of a full bar.
showValue bool true Shows the percentage next to the label.
classes String? null Extra JX classes, appended after the component classes.

Customizing

  • Pass classes to add or override utilities: they come last, so classes: 'w:full' wins over the default width.
  • Change the bar color in your theme (blue-700).

Accessibility

  • role="progressbar" with aria-valuenow, aria-valuemin, aria-valuemax and aria-label.
  • Indeterminate: no value is announced and aria-busy="true" is set.
  • With reduced motion, the indeterminate bar pulses in place instead of sliding.