Dashboard Studio & Widgets (pkg/widgets)
GoFilament includes a rich dashboard studio featuring 8 responsive widget types:
adminPanel.Widgets(
// 1. KPI Stats Overview with Sparklines
widgets.NewStatsOverviewWidget(func(ctx *filament.Context) []widgets.Stat {
return []widgets.Stat{
*widgets.NewStat("Total Revenue", "$128,450").
Description("+14.2% from last week").
DescriptionIcon("trending-up").
Color("success").
Chart([]float64{65, 78, 82, 95, 110, 128}),
*widgets.NewStat("Active Orders", "42").
Description("8 awaiting shipment").
Color("warning"),
*widgets.NewStat("System Health", "99.98%").
Description("All clusters nominal").
Color("info"),
}
}),
// 2. Chart.js Chart Widget
widgets.NewChartWidget("Fulfillment Trends", widgets.ChartTypeLine).
Height(300).
Data(func(ctx *filament.Context) widgets.ChartData {
return widgets.ChartData{
Labels: []string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"},
Datasets: []widgets.ChartDataset{
{
Label: "Delivered Orders",
Data: []float64{120, 150, 180, 220, 200, 240, 310},
BorderColor: "#10B981",
BackgroundColor: "rgba(16, 185, 129, 0.1)",
},
},
}
}),
// 3. Quick Table Widget
widgets.NewTableWidget("Recent Urgent Incidents"),
// 4. Milestone Timeline Widget
widgets.NewTimelineWidget("Deployment Milestones"),
// 5. Quick Shortcut Actions
widgets.NewQuickActionsWidget("Operational Actions"),
// 6. Progress Targets
widgets.NewProgressWidget("Monthly Target Completion"),
// 7. Alert Banner Widget
widgets.NewBannerWidget("Scheduled Maintenance", "Telemetry ingest will restart at 02:00 UTC."),
// 8. Percentage Breakdown Widget
widgets.NewBreakdownWidget("Traffic Source Distribution"),
)