Empty

A placeholder for a view with no data.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrEmpty } from 'ngwr/empty';

@Component({ imports: [WrEmpty] })
export class MyComponent {}

Default

<wr-empty />
No data

With description and action

Project the text; put buttons in wrEmptyActions.

<wr-empty iconName="search" title="No results">
  Try a different query or clear filters.
  <ng-container wrEmptyActions>
    <wr-btn (click)="reset()">Reset filters</wr-btn>
  </ng-container>
</wr-empty>
No results
Try a different query or clear filters.
Reset filters

Without the illustration

[icon]="false" hides the artwork, for a placeholder inside a card or a table.

<wr-empty [icon]="false" title="No results">Try a different query.</wr-empty>
No results
Try a different query.

API

NameDescriptionTypeDefault
iconRender the built-in folder glyph. Pass false to show no icon at all. Ignored when iconName is set — the same contract as <wr-alert>. This used to be typed as an icon NAME, which it never was: whatever name you passed, the template drew the folder. Any truthy value still shows it, so nothing that compiled before behaves differently.booleantrue
iconNameShow any registered ngwr icon instead of the built-in glyph.WrIconName | nullnull
titleHeadline. Falls back to empty.noData from WrI18n, then 'No data'.string | nullnull

CSS variables

Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/empty's own element.

VariableDefaultDeclared on
--wr-empty-actions-gapvar(--wr-space-sm).wr-empty
--wr-empty-actions-margin-topvar(--wr-space-sm).wr-empty
--wr-empty-description-font-sizevar(--wr-text-sm).wr-empty
--wr-empty-gapvar(--wr-space-sm).wr-empty
--wr-empty-icon-margin-bottomvar(--wr-space-xs).wr-empty
--wr-empty-padding-xvar(--wr-space-lg).wr-empty
--wr-empty-padding-yvar(--wr-space-xl).wr-empty
--wr-empty-title-font-sizevar(--wr-text-base).wr-empty
--wr-empty-title-font-weightvar(--wr-font-weight-semibold).wr-empty

Dependencies

Built onIcon

See also