Feedback
Skeleton
A pulsing placeholder with the shape of the content being loaded.
JxSkeleton
import 'package:jx_cli/ui.dart'
Available since 0.0.2
Preview
When to use it
- Lists and cards while their data loads, to avoid layout jumps.
Minimal example
JxSkeleton() // one line of text
JxSkeleton(classes: 'w:10 h:10 br:full') // an avatar
Complete example
A full Jaspr component you can paste into a project.
import 'package:jaspr/dom.dart';
import 'package:jaspr/jaspr.dart';
import 'package:jx_cli/ui.dart';
/// Three placeholder rows, shown while the list loads.
class ListPlaceholder extends StatelessComponent {
const ListPlaceholder({super.key});
@override
Component build(BuildContext context) {
return div(classes: 'flex fd:col gap:4', attributes: const {'aria-busy': 'true'}, [
for (var i = 0; i < 3; i++)
div(classes: 'flex ai:center gap:3', [
const JxSkeleton(classes: 'w:10 h:10 br:full shrink:0'),
div(classes: 'flex fd:col gap:2 grow:1', [
const JxSkeleton(classes: 'h:3 w:2/3'),
const JxSkeleton(classes: 'h:3 w:1/3'),
]),
]),
]);
}
}
Properties
| Property | Type | Default | Description |
|---|---|---|---|
classes |
String? |
'h:4 w:full' |
Size and shape. Replaces the default size when given. |
Accessibility
-
Hidden from screen readers (
aria-hidden). Mark the loading region witharia-busy="true". - The pulse stops when the system asks for reduced motion.