EmptyState
Distinguish no records, no matches, forbidden data, loading and failure.
Use the web element directly without the semantic runtime.
A registered presentation adapter can bind this component to host-owned meaning and state.
The standard recipe resolver does not select this component automatically.
Import and live example#
A no-matches result with a clear-filters action.
Interactive preview requires JavaScript.
View the complete example source
import {registerAeliqoElements} from "@varendo/web";
import {
AeliqoAlertElement,
AeliqoDialogElement,
AeliqoDrawerElement,
AeliqoEmptyStateElement,
AeliqoPopoverElement,
AeliqoProgressElement,
AeliqoSkeletonElement,
AeliqoToastElement,
AeliqoTooltipElement,
} from "@varendo/web/feedback";
registerAeliqoElements();
const host = document.querySelector<HTMLElement>("#aeliqo-example") ?? (() => {
const created = document.createElement("div");
created.id = "aeliqo-example";
(document.body ?? document.documentElement).append(created);
return created;
})();
function createCatalogRoot(container: HTMLElement): HTMLElement {
const root = document.createElement("div");
root.dataset.catalogSourceRoot = "true";
root.style.display = "grid";
root.style.gap = "12px";
container.append(root);
return root;
}
function createCatalogElement<T extends HTMLElement>(tagName: string, container: HTMLElement): T {
const element = document.createElement(tagName) as T;
element.setAttribute("data-aeliqo-theme", "light");
container.append(element);
return element;
}
function appendSlottedText(root: HTMLElement, slot: string, textContent: string): void {
const content = document.createElement("span");
content.slot = slot;
content.textContent = textContent;
root.append(content);
}
const root = createCatalogRoot(host);
(((root) => {
const element = createCatalogElement<AeliqoEmptyStateElement>("aeliqo-empty-state", root);
element.kind = "no-matches";
element.heading = "No matching reports";
element.message = "Try a broader team or date filter.";
element.actionLabel = "Clear filters";
}))(root);
Purpose#
Explains why a region has no content, with an explicit kind, heading, and message. An optional recovery button proposes a host action such as clearing filters.
When to use it#
- A list or panel has no records or no matches to show.
- The reason for the empty region should be named, not implied.
- Recovery needs a visible action, such as clearing filters.
When to use a different component#
- Use Alert for a warning while data is still available.
- Use Skeleton while the content is still loading.
Properties and defaults#
The kind describes the honest empty condition; the action is a host request to change filters.
| Property | Use and ownership | Declared type | Initial value |
|---|---|---|---|
kind | Selects the semantic empty-state treatment; it does not change application behavior. | AeliqoEmptyStateKind | 'no-records' |
heading | Provides the visible overlay or feedback heading and its accessible label. | string | 'No records' |
message | Provides the user-facing status, error, or recovery message. | string | 'There is nothing to display.' |
actionLabel | Provides the visible text for the action control or section. | string | '' |
Events#
| Event | Payload | Emitted | Application responsibility |
|---|---|---|---|
aeliqo-empty-state-action | The configured recovery action. | After the user activates the empty-state action. | Run the registered recovery path and update the surrounding data state. |
Events cross the component boundary as user proposals. Validate their detail and current authority before applying a business effect.
Listen for aeliqo-empty-state-action
const element = document.querySelector('aeliqo-empty-state');<p>element?.addEventListener('aeliqo-empty-state-action', (event) => {
const proposal = (event as CustomEvent<unknown>).detail;
// Validate the proposal, update host state, then assign controlled properties.
applyProposal(proposal);
});States and failure handling#
Relevant states:
- empty
- loading
- error
Expected result: The absence of matching data is explicit and the host can receive a typed recovery request.
Keyboard, focus, and accessibility#
Keyboard behavior:
- Tab
- Enter
- Space
Exposed semantics:
- aria-busy
- aria-live
- button
- role
- section
Responsive behavior#
Keep the recovery action visible when the page narrows. Let the explanation wrap within the host column.
Style hooks#
- Shadow parts:
action,heading,message,state - Varendo design tokens referenced:
--aeliqo-color-accent,--aeliqo-color-border,--aeliqo-color-on-accent,--aeliqo-control-min-target,--aeliqo-radius-medium,--aeliqo-radius-small,--aeliqo-space-12,--aeliqo-space-24,--aeliqo-space-8,--aeliqo-typography-font-weight-semibold
Related components#
Generated TypeScript declaration#
View generated declaration
export declare class AeliqoEmptyStateElement extends AeliqoFoundationElement {
static readonly properties: {
kind: {
type: StringConstructor;
};
heading: {
type: StringConstructor;
};
message: {
type: StringConstructor;
};
actionLabel: {
type: StringConstructor;
attribute: string;
};
};
static readonly styles: import("lit").CSSResult[];
kind: AeliqoEmptyStateKind;
heading: string;
message: string;
actionLabel: string;
private action;
protected render(): import("lit").TemplateResult<1>;
}Version#
This page documents the Varendo 0.6 component contract.
