Skip to content

Dashboard Widget for Angular

AngularDashboard

Enhances a host element in place into a titled dashboard panel (widget container, collapsible widget, dashboard tile): a header with a heading (level 2-6), optional subtitle, and action buttons (custom icon actions, collapse, maximize, remove) is inserted as the host’s first child; the host’s other children are the body and are never moved. The host is a region labelled by the title. Collapse is a disclosure button (aria-expanded) that hides the body. Maximize shows the widget in the top layer through the Popover API as a modal dialog (role=dialog, aria-modal, focus trapped, page scroll locked; Escape or the restore button restores). Remove emits a cancelable aui-remove; the application removes the widget or its grid item.

  • Titled regionA heading, a subtitle, and a labelled region around your own content.
  • Header actionsCustom icon actions plus collapse, maximize, and remove buttons.
  • Maximize as dialogMaximize shows the widget full screen as a modal dialog.
  • Content untouchedThe body stays your own children, so framework content is safe.

Behavior, design tokens, and limitations are described on the Dashboard Widget page; this page covers the Angular API.

import { Component } from '@angular/core';
import { AuiDashboardWidget } from '@absoluteui/angular/dashboard-widget';
@Component({
selector: 'app-sales-widget',
imports: [AuiDashboardWidget],
template: `
<aui-dashboard-widget [title]="'Sales'" subtitle="Last 30 days" [removable]="true" (removed)="removed = true">
<p>$48,200</p>
</aui-dashboard-widget>`,
})
export class SalesWidgetComponent {
removed = false;
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiDashboardWidget } from '@absoluteui/angular/dashboard-widget';

Defaults for every instance: provideAbsoluteUIConfig({ components: { dashboardWidget: { ... } } }) (see Configuration).

Class AuiDashboardWidget; template reference #ref="auiDashboardWidget".

AbsoluteUI Dashboard Widget; the projected content is the body: <aui-dashboard-widget title="Revenue" [removable]="true" (removed)="remove(id)">...</aui-dashboard-widget>. The header is inserted before the Angular-managed body. [(collapsed)] is two-way.

Server rendering: Renders in the browser only; on the server the element stays empty.

Input Type Default Description
title string Required. Heading text; names the region and the action buttons. Non-empty.
headingLevel 2 | 3 | 4 | 5 | 6 '3' Heading element level; changing it with update() throws.
subtitle string Supporting text under the heading (hidden when empty).
actions readonly DashboardWidgetAction[] Extra header icon buttons { id, label, icon } (unique ids, non-empty labels); activation emits aui-action.
removable boolean false Show a remove button that emits the cancelable aui-remove.
busy boolean false Set aria-busy=true on the host while content loads.
collapsible boolean true Show the collapse/expand button.
maximizable boolean true Show the maximize/restore button.
locale string 'en-US' Locale of the action button names.
direction Direction 'ltr' Resolved with the other options; the layout itself follows the document direction (logical CSS).
Model Type Change output Description
[(collapsed)] boolean (collapsedChange) Initial and controlled collapsed state (update() sets it without an event).
Output Payload Description
(toggled) DashboardWidgetToggleDetail The user activated the collapse/expand button. Re-emits aui-toggle.
(maximized) DashboardWidgetMaximizeDetail The widget was maximized or restored (button, Escape, or setMaximized). Re-emits aui-maximize.
(action) DashboardWidgetActionDetail The user activated a custom header action. Re-emits aui-action.
(removed) DashboardWidgetRemoveDetail The user activated the remove button; id is the host’s data-aui-item (its Dashboard Grid item) or null. The widget takes no default action: remove the element or call grid.removeItem(id). Re-emits aui-remove.

Call them through a viewChild query or a template reference.

Method Description
setMaximized(maximized: boolean): void Maximize the widget into a modal view, or restore it (emits maximized).

Pattern: Labelled region with a heading and header buttons; collapse follows the WAI-ARIA APG Disclosure pattern; maximize follows the APG modal Dialog pattern (top layer through the Popover API).

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Dashboard Widget: Accessibility and performance.