Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

DashboardGrid

Arrange projected dashboard tiles in a reorderable grid.

Category
Layout and content
Import
@neural-ui/core/dashboard-grid
Selector
neu-dashboard-grid
import { NeuDashboardGridComponent } from '@neural-ui/core/dashboard-grid';

Usage

Give each tile a stable id and project a rendered element with matching data-tile-id. Do not use an uninstantiated ng-template as tile content. cols and rows define a tile span; columns defines the grid. Accept orderChange by replacing tiles. Pointer dragging and arrow keys propose the same new order without mutating your array.

Examples

Try this application-owned interaction. Its event handling and initial data are included in Code.

Examples

Events: 0

Try and configure

Change the public options, try the result and inspect the updated template. Code contains the complete executable implementation.

Try and configure

Events: 0

template.html
<neu-dashboard-grid
  [tiles]="localizedTiles()"
  [columns]="2"
  (orderChange)="tiles.set($event); record('orderChange', $event)"
  ><div data-tile-id="sales">
    <strong>24.800 โ‚ฌ</strong>
    <p>{{ t("Monthly sales", "Ventas mensuales") }}</p>
  </div>
  <div data-tile-id="orders">
    <strong>128</strong>
    <p>{{ t("Open orders", "Pedidos abiertos") }}</p>
  </div>
  <div data-tile-id="customers">
    <strong>86</strong>
    <p>{{ t("Active customers", "Clientes activos") }}</p>
  </div></neu-dashboard-grid
>

State and events

Give each tile a stable id and project a rendered element with matching data-tile-id. Do not use an uninstantiated ng-template as tile content. cols and rows define a tile span; columns defines the grid. Accept orderChange by replacing tiles. Pointer dragging and arrow keys propose the same new order without mutating your array.

Accessibility and keyboard

Tab reaches tile handles. Arrow keys reorder the focused tile; Escape cancels an active drag.

Key
Action
Tab Reach enabled tile handles and actions.
Arrow keys Reorder the focused tile when keyboard reordering is enabled.
Escape Cancel an active drag.

API

Inputs, models and Outputs are extracted from the installed Core package. Named public types link to their definitions. Templates below include executable examples.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
columnsnumber3[columns]Number of columns in the dashboard grid.
tilesreadonly NeuDashboardTileConfig[][][tiles]Tile configuration with ids matching projected data-tile-id elements and optional row/column spans.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
orderChangereadonly NeuDashboardTileConfig[](orderChange)="onOrderChange($event)"Proposes the complete reordered array. Replace items or tiles to accept it.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
*

Projected content

View example
Content projection

Application-provided content.

<ng-content />

Context used: โ€”

Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.

Projected content

*

Projected content

Events: 0

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Use the supported public tokens listed below. Surrounding layout belongs to your application; validate the result in light and dark modes and narrow containers.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-focus-ring Normal keyboard-focus ring Shared by other Core consumers; scope the override. 0 0 0 var(--neu-focus-ring-width) rgba(0, 122, 255, 0.15)
--neu-primary Brand color for active controls and emphasis Shared by other Core consumers; scope the override. #007aff
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff
--neu-text Main text and inherited icon color Shared by other Core consumers; scope the override. #0f172a
--neu-text-muted Secondary labels and supporting content Shared by other Core consumers; scope the override. #475569
--neu-radius-xl Corner radius Shared by other Core consumers; scope the override. 16px