Feedback

Empty state

What to show when a list or a search has no result: a title, an explanation and an action.

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

Preview

No projects yet

Projects you create appear here. Start with a template or an empty project.

When to use it

  • A new account with no project yet.
  • A search with no match.
  • A filtered table with no row.

Minimal example

Dart
JxEmptyState(title: 'No results')

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 NoSearchResult extends StatelessComponent {
  const NoSearchResult({required this.query, required this.onClear, super.key});

  final String query;
  final VoidCallback onClear;

  @override
  Component build(BuildContext context) {
    return JxEmptyState(
      title: 'No result for "$query"',
      text: 'Check the spelling, or search for a shorter term.',
      action: JxButton(variant: JxButtonVariant.outline, onClick: onClear, [.text('Clear the search')]),
    );
  }
}

Properties

Property Type Default Description
title String required What is empty.
text String? null Why, and what to do next.
icon Component? null Decorative icon above the title.
action Component? null Usually a JxButton .
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.
  • Remove the dashed border with classes: 'bw:0'.

Accessibility

  • The icon is decorative (aria-hidden); the title and text carry the message.