Feedback

Spinner

A spinning loading indicator that takes the current text color.

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

Preview

Loading Loading Loading

When to use it

  • A wait of a few seconds with no known progress.
  • Inside a busy button (done for you by JxButton(loading: true)).

Minimal example

Dart
JxSpinner()

Complete example

A full Jaspr component you can paste into a project.

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

class LoadingPanel extends StatelessComponent {
  const LoadingPanel({super.key});

  @override
  Component build(BuildContext context) {
    return div(classes: 'flex ai:center jc:center gap:3 py:10 c:gray-500', [
      const JxSpinner(label: 'Loading invoices'),
      span(attributes: const {'aria-hidden': 'true'}, [.text('Loading invoices')]),
    ]);
  }
}

Properties

Property Type Default Description
size JxSpinnerSize md sm (16 px), md (20 px) or lg (32 px).
label String? 'Loading' Announced text. null makes the spinner decorative.
classes String? null Extra JX classes, appended after the component classes.

Customizing

  • Color it through the text color of a parent (c:blue-700) or with classes.

Accessibility

  • With a label, it is a role="status" region with screen-reader-only text.
  • It stops spinning when the system asks for reduced motion.