Dashboard Widget Development
Create custom dashboard widgets for the Gauzy dashboard.
Overviewโ
Dashboard widgets provide at-a-glance metrics and data visualizations on the main dashboard.
Widget Architectureโ
interface IDashboardWidget {
id: string;
name: string;
component: Type<any>;
defaultWidth: number; // Grid columns (1-12)
defaultHeight: number; // Grid rows
permissions?: string[];
}
Creating a Widgetโ
1. Create the Componentโ
@Component({
selector: "ga-my-widget",
template: `
<nb-card>
<nb-card-header>My Widget</nb-card-header>
<nb-card-body>
<div class="widget-content">
<span class="metric">{{ value }}</span>
<span class="label">Active Tasks</span>
</div>
</nb-card-body>
</nb-card>
`,
})
export class MyWidgetComponent implements OnInit {
value: number;
ngOnInit() {
this.loadData();
}
async loadData() {
this.value = await this.dashboardService.getActiveTaskCount();
}
}
2. Register the Widgetโ
@NgModule({
declarations: [MyWidgetComponent],
providers: [
{
provide: DASHBOARD_WIDGETS,
useValue: {
id: "my-widget",
name: "Active Tasks",
component: MyWidgetComponent,
defaultWidth: 4,
defaultHeight: 2,
},
multi: true,
},
],
})
export class MyWidgetModule {}
Built-in Widgetsโ
| Widget | Description | Default Size |
|---|---|---|
| Today's Log | Current day time log | 4 ร 2 |
| Active Tasks | Tasks in progress | 4 ร 2 |
| Team Activity | Team member status | 4 ร 3 |
| Income/Expense | Financial summary | 6 ร 3 |
| Project Progress | Project completion | 6 ร 3 |
API Referenceโ
- Dashboard Endpoints โ dashboard data API
- Dashboard Widget Endpoints โ widget CRUD
Related Pagesโ
- Admin Dashboard โ dashboard guide
- Angular Module Architecture โ module patterns