# Angular Dashboard Grid Component

DashboardGrid lays out tiles on a grid. In edit mode the tiles are dragged and resized with the mouse, a finger or the keyboard, the other tiles make room, and every move is announced to screen readers. The layout adapts to the width of the grid, renders on the server and has no dependency.

## Basic

DashboardGrid places tiles on a grid of columns , 12 by default, and rows of rowHeight pixels, with a gap between them. The layout is an array of tiles, each with an id , a column x and a row y counted from 0, a width w in columns and a height h in rows. The grid is a CSS grid, so the layout renders on the server and before the JavaScript loads. The item template draws a tile: it receives the tile as the implicit variable, its position as displayed, and the editable , grabbed , dragging and resizing flags. Write it as &lt;ng-template [pDashboardGridItem]="layout" let-tile&gt; to type tile with the type of your layout, or as &lt;ng-template #item let-tile&gt; . With editable , tiles are dragged to move them and resized by their corner, and the grid updates layout with a new array, so bind it two-way with [(layout)] .

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DashboardGridItem, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';

@Component({
    template: `
        <div class="card">
            <div class="flex items-center gap-2 mb-4">
                <p-toggle-switch [(ngModel)]="editable" inputId="dashboardgrid-basic-edit" />
                <label for="dashboardgrid-basic-edit">Edit the layout</label>
            </div>
            <p-dashboard-grid [(layout)]="layout" [editable]="editable" [rowHeight]="64" ariaLabel="Basic dashboard">
                <ng-template [pDashboardGridItem]="layout" let-tile let-position="position">
                    <span class="font-semibold">{{ tile.label }}</span>
                    <span class="text-sm text-muted-color">{{ position.w }} × {{ position.h }}</span>
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [DashboardGridModule, ToggleSwitchModule, FormsModule]
})
export class DashboardgridBasicDemo {
    editable = true;

    layout: DashboardGridItem[] = [
        { id: 'sales', label: 'Sales', x: 0, y: 0, w: 6, h: 2 },
        { id: 'visitors', label: 'Visitors', x: 6, y: 0, w: 3, h: 2 },
        { id: 'orders', label: 'Orders', x: 9, y: 0, w: 3, h: 2 },
        { id: 'revenue', label: 'Revenue', x: 0, y: 2, w: 4, h: 2 },
        { id: 'tickets', label: 'Tickets', x: 4, y: 2, w: 4, h: 2 },
        { id: 'uptime', label: 'Uptime', x: 8, y: 2, w: 4, h: 2 }
    ];
}
```

## Drag Handle

Without a drag handle, a tile drags from anywhere but its buttons, links and form fields. dragHandle takes a CSS selector, such as .drag-handle , and only the matching element of a tile starts a drag: the rest of the tile stays free for selecting text, scrolling and clicking, and on touch screens the page still scrolls when a finger moves over a tile. The grid gives the handle the grab cursor. The keyboard still moves the whole tile.

```typescript
import { Component } from '@angular/core';
import { ButtonModule } from '@exhaustive-ui/core/button';
import { DashboardGridItem, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';
import { bars } from '@exhaustive-ui/icons/round';
import { SvgIcon } from '@exhaustive-ui/core/icon';

@Component({
    template: `
        <div class="card">
            <p-dashboard-grid [(layout)]="layout" editable dragHandle=".drag-handle" [rowHeight]="72" ariaLabel="Dashboard with drag handles">
                <ng-template [pDashboardGridItem]="layout" let-tile>
                    <div class="flex items-center gap-2 mb-2">
                        <span class="drag-handle flex items-center justify-center w-6 h-6 rounded-border text-muted-color hover:bg-emphasis" aria-hidden="true">
                            <svg pIcon [icon]="bars"></svg>
                        </span>
                        <span class="font-semibold">{{ tile.label }}</span>
                    </div>
                    <p class="m-0 text-sm text-muted-color">{{ tile.data?.text }}</p>
                    <p-button class="mt-auto self-start" [label]="'Open ' + tile.label" size="small" text (onClick)="opened = tile.label" />
                </ng-template>
            </p-dashboard-grid>
            <p class="mt-4 mb-0 text-sm text-muted-color" aria-live="polite">{{ opened ? 'Opened ' + opened : 'The buttons of the tiles still work.' }}</p>
        </div>
    `,
    standalone: true,
    imports: [SvgIcon, DashboardGridModule, ButtonModule]
})
export class DashboardgridDraghandleDemo {
    bars = bars;

    opened = '';

    layout: DashboardGridItem<{ text: string }>[] = [
        { id: 'inbox', label: 'Inbox', x: 0, y: 0, w: 4, h: 2, data: { text: '12 unread messages, 3 flagged.' } },
        { id: 'calendar', label: 'Calendar', x: 4, y: 0, w: 4, h: 2, data: { text: 'Design review at 2:30 PM.' } },
        { id: 'tasks', label: 'Tasks', x: 8, y: 0, w: 4, h: 2, data: { text: '5 tasks due this week.' } }
    ];
}
```

## Resize and Compaction

resizeHandles lists the sides and corners that resize a tile: n , s , e , w , ne , nw , se and sw , with se alone by default. e is the inline end, the right side in left-to-right pages and the left side in right-to-left ones. A tile stays within its minW , maxW , minH and maxH , in cells, and within the columns; resizable: false or draggable: false turn off one of the two for a tile. While a tile grows, the tiles in its way are pushed down. With compact set to vertical , the default, the tiles then move up to fill the gaps; with none they stay where they are dropped, and empty rows are kept.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DashboardGridCompact, DashboardGridItem, DashboardGridModule, DashboardGridResizeHandle } from '@exhaustive-ui/core/dashboardgrid';
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';

@Component({
    template: `
        <div class="card">
            <div class="flex items-center gap-3 mb-4">
                <span id="dashboardgrid-compact-label">Compaction</span>
                <p-select-button [options]="compactOptions" [(ngModel)]="compact" [allowEmpty]="false" ariaLabelledBy="dashboardgrid-compact-label" />
            </div>
            <p-dashboard-grid [(layout)]="layout" editable [compact]="compact" [resizeHandles]="handles" [rowHeight]="56" ariaLabel="Resizable tiles">
                <ng-template [pDashboardGridItem]="layout" let-tile let-position="position">
                    <span class="font-semibold">{{ tile.label }}</span>
                    <span class="text-sm text-muted-color">{{ position.w }} × {{ position.h }}</span>
                    <span class="text-sm text-muted-color mt-auto">{{ tile.data?.limits }}</span>
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [DashboardGridModule, SelectButtonModule, FormsModule]
})
export class DashboardgridResizeDemo {
    compact: DashboardGridCompact = 'vertical';

    compactOptions = [
        { label: 'Vertical', value: 'vertical' },
        { label: 'None', value: 'none' }
    ];

    handles: DashboardGridResizeHandle[] = ['n', 'e', 's', 'w', 'ne', 'nw', 'se', 'sw'];

    layout: DashboardGridItem<{ limits: string }>[] = [
        { id: 'free', label: 'Free', x: 0, y: 0, w: 4, h: 2, data: { limits: 'Any size' } },
        { id: 'wide', label: 'Wide', x: 4, y: 0, w: 6, h: 2, minW: 4, maxW: 8, data: { limits: '4 to 8 columns' } },
        { id: 'tall', label: 'Tall', x: 10, y: 0, w: 2, h: 3, minH: 3, maxH: 5, data: { limits: '3 to 5 rows' } },
        { id: 'fixed', label: 'Fixed size', x: 0, y: 2, w: 3, h: 2, resizable: false, data: { limits: 'Moves, does not resize' } },
        { id: 'pinned', label: 'Pinned', x: 3, y: 2, w: 3, h: 2, draggable: false, data: { limits: 'Resizes, does not move' } }
    ];
}
```

## Static Tiles

A static tile never moves: it can not be dragged or resized, a dragged tile can not be dropped over it, and the tiles pushed or compacted go around it. It is not focusable in edit mode, since nothing can be done to it. Use it for a header, a notice or a tile the user must keep in view.

```typescript
import { Component } from '@angular/core';
import { DashboardGridItem, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';
import { lock } from '@exhaustive-ui/icons/round';
import { SvgIcon } from '@exhaustive-ui/core/icon';

@Component({
    template: `
        <div class="card">
            <p-dashboard-grid [(layout)]="layout" editable [rowHeight]="56" ariaLabel="Dashboard with static tiles">
                <ng-template [pDashboardGridItem]="layout" let-tile>
                    <div class="flex items-center gap-2">
                        @if (tile.static) {
                            <svg pIcon [icon]="lock" class="text-muted-color" aria-hidden="true"></svg>
                        }
                        <span class="font-semibold">{{ tile.label }}</span>
                    </div>
                    <span class="text-sm text-muted-color">{{ tile.static ? 'Static' : 'Movable' }}</span>
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [SvgIcon, DashboardGridModule]
})
export class DashboardgridStaticDemo {
    lock = lock;

    layout: DashboardGridItem[] = [
        { id: 'header', label: 'Quarterly overview', x: 0, y: 0, w: 12, h: 1, static: true },
        { id: 'sales', label: 'Sales', x: 0, y: 1, w: 4, h: 2 },
        { id: 'notice', label: 'Maintenance notice', x: 4, y: 1, w: 4, h: 2, static: true },
        { id: 'traffic', label: 'Traffic', x: 8, y: 1, w: 4, h: 2 },
        { id: 'orders', label: 'Orders', x: 0, y: 3, w: 6, h: 2 },
        { id: 'refunds', label: 'Refunds', x: 6, y: 3, w: 6, h: 2 }
    ];
}
```

## Responsive

The grid follows its own width, not the width of the window. breakpoints gives the number of columns at or below a maxWidth in pixels, and the smallest matching breakpoint applies. A breakpoint without a layout gets the base layout scaled to its columns; layouts holds a layout per breakpoint name, with the id , x , y , w and h of the tiles. A tile missing from it goes to the first free space, and the edits made at a breakpoint are saved in layouts , so bind it two-way with [(layouts)] . Below stackBelow pixels, 576 by default, the tiles are stacked in a single column in reading order, each with its height, and can not be edited. onBreakpointChange tells the breakpoint, the columns and whether the tiles are stacked. Resize the window to see the layout change.

```typescript
import { Component } from '@angular/core';
import { DashboardGridBreakpoint, DashboardGridBreakpointChangeEvent, DashboardGridItem, DashboardGridItemPosition, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';

@Component({
    template: `
        <div class="card">
            <p class="mt-0 mb-4 text-sm text-muted-color" aria-live="polite">{{ status }}</p>
            <p-dashboard-grid [(layout)]="layout" [(layouts)]="layouts" editable [breakpoints]="breakpoints" [stackBelow]="480" [rowHeight]="56" (onBreakpointChange)="onBreakpointChange($event)" ariaLabel="Responsive dashboard">
                <ng-template [pDashboardGridItem]="layout" let-tile let-position="position">
                    <span class="font-semibold">{{ tile.label }}</span>
                    <span class="text-sm text-muted-color">Column {{ position.x + 1 }}, row {{ position.y + 1 }}</span>
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [DashboardGridModule]
})
export class DashboardgridResponsiveDemo {
    status = '12 columns';

    breakpoints: DashboardGridBreakpoint[] = [
        { name: 'md', maxWidth: 960, columns: 6 },
        { name: 'sm', maxWidth: 720, columns: 4 }
    ];

    layout: DashboardGridItem[] = [
        { id: 'sales', label: 'Sales', x: 0, y: 0, w: 8, h: 2 },
        { id: 'goal', label: 'Goal', x: 8, y: 0, w: 4, h: 2 },
        { id: 'visitors', label: 'Visitors', x: 0, y: 2, w: 4, h: 2 },
        { id: 'orders', label: 'Orders', x: 4, y: 2, w: 4, h: 2 },
        { id: 'storage', label: 'Storage', x: 8, y: 2, w: 4, h: 2 }
    ];

    layouts: Record<string, DashboardGridItemPosition[]> = {
        sm: [
            { id: 'sales', x: 0, y: 0, w: 4, h: 2 },
            { id: 'goal', x: 0, y: 2, w: 2, h: 2 },
            { id: 'visitors', x: 2, y: 2, w: 2, h: 2 },
            { id: 'orders', x: 0, y: 4, w: 2, h: 2 },
            { id: 'storage', x: 2, y: 4, w: 2, h: 2 }
        ]
    };

    onBreakpointChange(event: DashboardGridBreakpointChangeEvent) {
        this.status = event.stacked ? 'Stacked in a single column' : `${event.breakpoint ? event.breakpoint + ' breakpoint, ' : ''}${event.columns} columns`;
    }
}
```

## Add and Remove

addItem adds a tile: without x and y , or when its place is taken, it goes to the first free space, found with findFreeSpace , and it is also placed in every layout of layouts . removeItem removes a tile by its id, and the others move up. Both update layout , emit onLayoutChange with the add or remove action and are announced to screen readers. A tile holds any component. Give the content of a tile flex-1 min-h-0 to fill its height, as the charts below do.

```typescript
import { isPlatformBrowser } from '@angular/common';
import { Component, inject, PLATFORM_ID, viewChild } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ButtonModule } from '@exhaustive-ui/core/button';
import { ChartModule } from '@exhaustive-ui/core/chart';
import { DashboardGrid, DashboardGridItem, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';
import { KnobModule } from '@exhaustive-ui/core/knob';
import { MeterGroupModule } from '@exhaustive-ui/core/metergroup';
import { bullseye, chartBar, chartLine, database, times } from '@exhaustive-ui/icons/round';

type Widget = { type: 'line' | 'bar' | 'goal' | 'storage' };

@Component({
    template: `
        <div class="card">
            <div class="flex flex-wrap gap-2 mb-4">
                <p-button label="Add a line chart" [icon]="chartLine" severity="secondary" size="small" (onClick)="add('line')" />
                <p-button label="Add a bar chart" [icon]="chartBar" severity="secondary" size="small" (onClick)="add('bar')" />
                <p-button label="Add a goal" [icon]="bullseye" severity="secondary" size="small" (onClick)="add('goal')" />
                <p-button label="Add storage" [icon]="database" severity="secondary" size="small" (onClick)="add('storage')" />
            </div>
            <p-dashboard-grid #grid [(layout)]="layout" editable dragHandle=".widget-title" [rowHeight]="72" ariaLabel="Analytics dashboard">
                <ng-template [pDashboardGridItem]="layout" let-tile>
                    <div class="flex items-center justify-between gap-2 mb-2">
                        <span class="widget-title font-semibold grow truncate">{{ tile.label }}</span>
                        <p-button [icon]="times" text rounded size="small" severity="secondary" [ariaLabel]="'Remove ' + tile.label" (onClick)="grid.removeItem(tile.id)" />
                    </div>
                    @switch (tile.data?.type) {
                        @case ('line') {
                            <div class="flex-1 min-h-0">
                                <p-chart type="line" [data]="lineData" [options]="chartOptions" height="100%" [ariaLabel]="tile.label + ', weekly visits, line chart'" />
                            </div>
                        }
                        @case ('bar') {
                            <div class="flex-1 min-h-0">
                                <p-chart type="bar" [data]="barData" [options]="chartOptions" height="100%" [ariaLabel]="tile.label + ', orders by channel, bar chart'" />
                            </div>
                        }
                        @case ('goal') {
                            <div class="flex-1 min-h-0 flex items-center justify-center">
                                <p-knob [(ngModel)]="goal" [size]="110" valueTemplate="{value}%" [ariaLabel]="tile.label + ' completion'" />
                            </div>
                        }
                        @case ('storage') {
                            <div class="flex-1 min-h-0 flex flex-col justify-center">
                                <p-meter-group [value]="storage" [ariaLabel]="tile.label + ' usage'" />
                            </div>
                        }
                    }
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [DashboardGridModule, ButtonModule, ChartModule, KnobModule, MeterGroupModule, FormsModule]
})
export class DashboardgridAddremoveDemo {
    chartLine = chartLine;
    chartBar = chartBar;
    bullseye = bullseye;
    database = database;
    times = times;

    dashboard = viewChild.required<DashboardGrid>('grid');

    platformId = inject(PLATFORM_ID);

    goal = 72;

    storage = [
        { label: 'Apps', color: '#34d399', value: 16 },
        { label: 'Messages', color: '#fbbf24', value: 8 },
        { label: 'Media', color: '#60a5fa', value: 24 },
        { label: 'System', color: '#c084fc', value: 10 }
    ];

    lineData: any;

    barData: any;

    chartOptions: any;

    private count = 0;

    layout: DashboardGridItem<Widget>[] = [
        { id: 'visits', label: 'Visits', x: 0, y: 0, w: 8, h: 3, minW: 4, minH: 2, data: { type: 'line' } },
        { id: 'goal', label: 'Quarter goal', x: 8, y: 0, w: 4, h: 3, minW: 3, minH: 2, data: { type: 'goal' } },
        { id: 'orders', label: 'Orders', x: 0, y: 3, w: 6, h: 3, minW: 4, minH: 2, data: { type: 'bar' } },
        { id: 'storage', label: 'Storage', x: 6, y: 3, w: 6, h: 2, minW: 4, data: { type: 'storage' } }
    ];

    constructor() {
        this.initCharts();
    }

    add(type: Widget['type']) {
        const names = { line: 'Visits', bar: 'Orders', goal: 'Goal', storage: 'Storage' };
        const size = type === 'storage' ? { w: 6, h: 2 } : type === 'goal' ? { w: 4, h: 3 } : { w: 6, h: 3 };
        this.count++;
        this.dashboard().addItem({ id: `${type}-${this.count}`, label: `${names[type]} ${this.count + 1}`, ...size, minW: 3, minH: 2, data: { type } });
    }

    initCharts() {
        if (!isPlatformBrowser(this.platformId)) {
            return;
        }
        const style = getComputedStyle(document.documentElement);
        const text = style.getPropertyValue('--p-text-muted-color');
        const border = style.getPropertyValue('--p-content-border-color');
        this.lineData = {
            labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            datasets: [{ label: 'Visits', data: [420, 510, 480, 620, 700, 380, 350], fill: false, borderColor: style.getPropertyValue('--p-primary-color'), tension: 0.4 }]
        };
        this.barData = {
            labels: ['Web', 'Mobile', 'Store', 'Partners'],
            datasets: [{ label: 'Orders', data: [320, 280, 140, 90], backgroundColor: style.getPropertyValue('--p-primary-color') }]
        };
        this.chartOptions = {
            maintainAspectRatio: false,
            animation: false,
            plugins: { legend: { display: false } },
            scales: {
                x: { ticks: { color: text }, grid: { color: border } },
                y: { ticks: { color: text }, grid: { color: border } }
            }
        };
    }
}
```

## Saving the Layout

onLayoutChange is emitted once a tile is dropped, resized, added or removed, after layout or layouts is updated, with the layout as displayed, the breakpoint that was edited, the columns , the action and the item . A keyboard move only emits when the tile is dropped, and Escape emits nothing. Save the positions from there: this demo keeps them in the local storage of the browser, so the layout is the same after a reload. Save only the id , x , y , w and h of the tiles and merge them with the tiles of the application when loading, so that new tiles and new settings are not lost.

```typescript
import { isPlatformBrowser } from '@angular/common';
import { Component, inject, PLATFORM_ID } from '@angular/core';
import { ButtonModule } from '@exhaustive-ui/core/button';
import { DashboardGridItem, DashboardGridItemPosition, DashboardGridLayoutChangeEvent, DashboardGridModule } from '@exhaustive-ui/core/dashboardgrid';
import { refresh } from '@exhaustive-ui/icons/round';

const STORAGE_KEY = 'exhaustive-ui-dashboardgrid-demo';

const defaultLayout = (): DashboardGridItem[] => [
    { id: 'sales', label: 'Sales', x: 0, y: 0, w: 6, h: 2 },
    { id: 'visitors', label: 'Visitors', x: 6, y: 0, w: 6, h: 2 },
    { id: 'orders', label: 'Orders', x: 0, y: 2, w: 4, h: 2 },
    { id: 'refunds', label: 'Refunds', x: 4, y: 2, w: 8, h: 2 }
];

@Component({
    template: `
        <div class="card">
            <div class="flex flex-wrap items-center gap-3 mb-4">
                <p-button label="Reset the layout" [icon]="refresh" severity="secondary" size="small" (onClick)="reset()" />
                <span class="text-sm text-muted-color" aria-live="polite">{{ status }}</span>
            </div>
            <p-dashboard-grid [(layout)]="layout" editable [rowHeight]="56" (onLayoutChange)="save($event)" ariaLabel="Saved dashboard">
                <ng-template [pDashboardGridItem]="layout" let-tile let-position="position">
                    <span class="font-semibold">{{ tile.label }}</span>
                    <span class="text-sm text-muted-color">Column {{ position.x + 1 }}, row {{ position.y + 1 }}</span>
                </ng-template>
            </p-dashboard-grid>
        </div>
    `,
    standalone: true,
    imports: [DashboardGridModule, ButtonModule]
})
export class DashboardgridPersistDemo {
    refresh = refresh;

    platformId = inject(PLATFORM_ID);

    layout = this.load();

    status = '';

    save(event: DashboardGridLayoutChangeEvent) {
        const positions: DashboardGridItemPosition[] = this.layout.map(({ id, x, y, w, h }) => ({ id, x, y, w, h }));
        try {
            localStorage.setItem(STORAGE_KEY, JSON.stringify(positions));
            this.status = `Saved after the ${event.action} of ${event.item.label}`;
        } catch {
            this.status = 'The browser does not allow saving';
        }
    }

    reset() {
        this.layout = defaultLayout();
        try {
            localStorage.removeItem(STORAGE_KEY);
        } catch {
            // nothing saved
        }
        this.status = 'Layout reset';
    }

    private load(): DashboardGridItem[] {
        const tiles = defaultLayout();
        if (!isPlatformBrowser(this.platformId)) {
            return tiles;
        }
        try {
            const saved: DashboardGridItemPosition[] = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
            return tiles.map((tile) => {
                const position = saved.find((other) => other.id === tile.id);
                return position ? { ...tile, x: position.x, y: position.y, w: position.w, h: position.h } : tile;
            });
        } catch {
            return tiles;
        }
    }
}
```

## Accessibility

Screen Reader The grid is a list and each tile a list item, in reading order, row by row, whatever the order of the layout array, so the tab order and the reading order follow what is on screen. A tile is named by its label , or by the field or function given to itemLabel . Name the grid with ariaLabel or ariaLabelledBy : it then gets the group role. In edit mode, every tile that can move or be resized is focusable and described with aria-describedby by the instructions to move it. A tile is moved and resized with the keyboard alone, and a polite live region announces each step: "Picked up Sales, column 1, row 1, 4 columns wide and 2 rows high", "Moved Sales to column 3, row 2", "Resized Sales to 6 columns wide and 2 rows high", "Dropped Sales at column 3, row 2, 6 columns wide and 2 rows high" or "Cancelled, Sales returned to column 1, row 1". A move blocked by the edge or a static tile, and a size beyond the limits of a tile, are announced too, and so are the tiles added and removed with addItem and removeItem . Translate every text with labels . The resize handles are drawn for the pointer and hidden from assistive technologies, since Shift and the arrow keys resize a tile. Static tiles are not focusable. Keep the content of a tile reachable: its buttons, links and fields work as usual, and the keys pressed in them never move the tile. The tiles glide to their new place unless the user prefers reduced motion.

## Pass Through Options

| Name | Type | Description |
|------|------|-------------|
| root | PassThroughOption<HTMLElement, I> | Used to pass attributes to the root's DOM element. |
| grid | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the CSS grid that holds the tiles. |
| item | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to a tile's DOM element. |
| itemContent | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the content of a tile, around the item template. |
| resizeHandle | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to a resize handle of a tile. |
| placeholder | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the placeholder that shows where a dragged tile lands. |

## Theming

### CSS Classes

| Class | Description |
|-------|-------------|
| p-dashboardgrid | Class name of the root element |
| p-dashboardgrid-grid | Class name of the CSS grid |
| p-dashboardgrid-item | Class name of a tile |
| p-dashboardgrid-item-content | Class name of the content of a tile |
| p-dashboardgrid-resize-handle | Class name of a resize handle |
| p-dashboardgrid-placeholder | Class name of the placeholder of a dragged tile |

### Design Tokens

| Token | CSS Variable | Description |
|-------|--------------|-------------|
| dashboardgrid.transition.duration | --p-dashboardgrid-transition-duration | Transition duration |
| dashboardgrid.gap | --p-dashboardgrid-gap | Gap between the tiles, when the gap input is not set |
| dashboardgrid.item.background | --p-dashboardgrid-item-background | Background of a tile |
| dashboardgrid.item.border.color | --p-dashboardgrid-item-border-color | Border color of a tile |
| dashboardgrid.item.hover.border.color | --p-dashboardgrid-item-hover-border-color | Border color of a movable tile on hover |
| dashboardgrid.item.border.radius | --p-dashboardgrid-item-border-radius | Border radius of a tile |
| dashboardgrid.item.color | --p-dashboardgrid-item-color | Text color of a tile |
| dashboardgrid.item.padding | --p-dashboardgrid-item-padding | Padding of a tile |
| dashboardgrid.item.shadow | --p-dashboardgrid-item-shadow | Shadow of a tile |
| dashboardgrid.item.static.background | --p-dashboardgrid-item-static-background | Background of a static tile |
| dashboardgrid.item.grabbed.border.color | --p-dashboardgrid-item-grabbed-border-color | Border color of a tile picked up with the keyboard or being resized |
| dashboardgrid.item.grabbed.shadow | --p-dashboardgrid-item-grabbed-shadow | Shadow of a tile picked up with the keyboard or being resized |
| dashboardgrid.item.dragging.shadow | --p-dashboardgrid-item-dragging-shadow | Shadow of a tile dragged with the pointer |
| dashboardgrid.item.focus.ring.width | --p-dashboardgrid-item-focus-ring-width | Focus ring width of a tile |
| dashboardgrid.item.focus.ring.style | --p-dashboardgrid-item-focus-ring-style | Focus ring style of a tile |
| dashboardgrid.item.focus.ring.color | --p-dashboardgrid-item-focus-ring-color | Focus ring color of a tile |
| dashboardgrid.item.focus.ring.offset | --p-dashboardgrid-item-focus-ring-offset | Focus ring offset of a tile |
| dashboardgrid.item.focus.ring.shadow | --p-dashboardgrid-item-focus-ring-shadow | Focus ring shadow of a tile |
| dashboardgrid.placeholder.background | --p-dashboardgrid-placeholder-background | Background of the placeholder that shows where a dragged tile lands |
| dashboardgrid.placeholder.border.color | --p-dashboardgrid-placeholder-border-color | Border color of the placeholder |
| dashboardgrid.placeholder.border.radius | --p-dashboardgrid-placeholder-border-radius | Border radius of the placeholder |
| dashboardgrid.resize.handle.size | --p-dashboardgrid-resize-handle-size | Size of the hit area of a corner resize handle |
| dashboardgrid.resize.handle.color | --p-dashboardgrid-resize-handle-color | Color of a resize handle |
| dashboardgrid.resize.handle.hover.color | --p-dashboardgrid-resize-handle-hover-color | Color of a resize handle on hover and while resizing |

