Skip to content

DashboardAlerts

Blocks for what is happening: alerts ordered by severity (KlyDashboardAlerts), a timeline of events (KlyDashboardFeed) and a list of labeled values (KlyDashboardDetails).

On this page

Examples

Alerts

The default order puts errors first and successes last, and DashboardAlertOrder.AsGiven keeps the order of the items. Limit is applied after the ordering. An alert with an ActionLabel and no ActionHref draws a button only when OnAction has a handler, and one with an ActionHref always draws a link.

By severity

The default order

Critical
Payment webhook failingLast 12 deliveries returned 500
12
Warning
Disk usage above 80%Volume data-2
83%
Info
Maintenance on FridayFrom 22:00 to 23:00 UTC
Resolved
Backup finishedNightly backup of the orders database
02:14

As given, 2 shown

Resolved
Backup finishedNightly backup of the orders database
02:14
Warning
Disk usage above 80%Volume data-2
83%

Last action: none

Razor
<div class="flex w-full flex-col gap-3">
    <KlyDashboardGrid>
        <KlyDashboardAlerts Title="By severity" Subtitle="The default order" Span="6" Items="_items" OnAction="Act" />
        <KlyDashboardAlerts Title="As given, 2 shown" Span="6" Items="_items" Order="DashboardAlertOrder.AsGiven" Limit="2" />
    </KlyDashboardGrid>
    <p class="m-0 text-sm text-(--klyroo-text-muted)">Last action: @(_action ?? "none")</p>
</div>

@code {
    private static readonly IReadOnlyList<DashboardAlertItem> _items =
    [
        new(DashboardAlertSeverity.Success, "Backup finished", "Nightly backup of the orders database", "02:14"),
        new(DashboardAlertSeverity.Warning, "Disk usage above 80%", "Volume data-2", "83%", ActionLabel: "Review"),
        new(DashboardAlertSeverity.Error, "Payment webhook failing", "Last 12 deliveries returned 500", "12", ActionLabel: "Open log"),
        new(DashboardAlertSeverity.Info, "Maintenance on Friday", "From 22:00 to 23:00 UTC"),
    ];

    private string? _action;

    private void Act(DashboardAlertItem alert) => _action = $"{alert.ActionLabel} on \"{alert.Label}\"";
}

Feed

The events are shown in the order given, not sorted. GroupByDay inserts a heading (Today, Yesterday or an ISO date) when the day changes, and Now is the reference for the headings and the relative times: leave it out for the current UTC time, or set it to get the same output in a test.

Activity

Grouped by day

Today
SK
Order 1042 shipped
To Northwind, EMEA
LM
Invoice 8812 paid
Yesterday
AB
Order 1041 refunded
Damaged in transit
2026-11-27
•
Customer Hooli created

Latest three

No day headings

SK
Order 1042 shipped
To Northwind, EMEA
LM
Invoice 8812 paid
AB
Order 1041 refunded
Damaged in transit
Razor
<KlyDashboardGrid>
    <KlyDashboardFeed Title="Activity" Subtitle="Grouped by day" Span="6" Items="_items" Now="_now" />
    <KlyDashboardFeed Title="Latest three" Subtitle="No day headings" Span="6" Items="_items" Now="_now" GroupByDay="false" Limit="3" />
</KlyDashboardGrid>

@code {
    // Now is the reference of the day headings and of the relative times: fixed once so both feeds agree.
    private readonly DateTimeOffset _now = DateTimeOffset.UtcNow;
    private IReadOnlyList<DashboardFeedItem> _items = [];

    // Events are shown in the order given: they are not sorted.
    protected override void OnInitialized() => _items =
    [
        new("Order 1042 shipped", _now.AddMinutes(-12), "To Northwind, EMEA", "SK"),
        new("Invoice 8812 paid", _now.AddHours(-3), AvatarText: "LM"),
        new("Order 1041 refunded", _now.AddDays(-1).AddHours(-1), "Damaged in transit", "AB"),
        new("Customer Hooli created", _now.AddDays(-3)),
    ];
}

Details

A row can show a hint, a monospaced value, a link (Href) and a button that copies the value (Copy, which needs an interactive render mode and a secure context), and FullSpan spans both columns on wide screens. An empty value shows the missing-value placeholder, and a Hidden row is left out.

Order 1042

Shipped to Northwind

Order id
ord_9f3a21c7
Customer
Northwind
Since March 2024
Total
1,284.50
Delivery note
Leave at the loading dock before 5 pm.
Coupon
—
Razor
<KlyDashboardGrid>
    <KlyDashboardDetails Title="Order 1042" Subtitle="Shipped to Northwind" Span="12" Items="_items" />
</KlyDashboardGrid>

@code {
    private static readonly IReadOnlyList<DashboardDetailsItem> _items =
    [
        new("id", "Order id", "ord_9f3a21c7", Mono: true, Copy: true),
        new("customer", "Customer", "Northwind", Hint: "Since March 2024"),
        new("email", "Contact", "billing@example.com", Href: "mailto:billing@example.com"),
        new("total", "Total", "1,284.50"),
        new("note", "Delivery note", "Leave at the loading dock before 5 pm.", FullSpan: true),
        new("internal", "Internal reference", "not shown", Hidden: true),
        new("coupon", "Coupon", null),
    ];
}

API

KlyDashboardAlerts

A list of alerts ordered by severity, each with an optional value and an action link or button.

Parameters

Name Type Default Description
Card bool true Whether the block draws its own surface (border, background and shadow; only the background in a panels grid). Defaults to true .
Class string Classes added to the root element, merged last so they win over the theme.
Freshness bool? Shows an Updated footer built from Source.UpdatedAt . When null , the value of the enclosing KlyDashboardGrid.Freshness applies, or false outside a grid.
Items IReadOnlyList<DashboardAlertItem> The alerts to display.
Limit int? The maximum number of alerts shown, applied after ordering. The table view and the CSV export hold the same alerts.
Menu bool? Shows the View as table, Download CSV and Expand buttons in the header once the content is displayed. Download CSV saves the block's table as a CSV file named after the title. When null , the value of the enclosing KlyDashboardGrid.Menu applies, or false outside a grid.
Order DashboardAlertOrder DashboardAlertOrder.Severity Severity (the default) puts errors first and successes last. AsGiven keeps the order of Items . Values: Severity, AsGiven.
Source IDashboardSource The resource whose state drives the block: a skeleton while it loads, an error message with a retry button, then the content. The block does not read Data from it, so pass the data through the other parameters. Without a source the content renders immediately.
Span int 6 Width of the block in columns of the grid, clamped between 1 and the Columns of the enclosing KlyDashboardGrid (12 outside a grid). Defaults to 6.
Subtitle string A secondary line under the title.
Title string The heading of the block.

Events

Name Type Description
OnAction EventCallback<DashboardAlertItem> Called with the alert when the user clicks its action. An alert with an ActionLabel and no ActionHref renders its action as a button only when this has a handler; without one the action is left out. An alert with an ActionHref always renders a link.

KlyDashboardFeed

A timeline of events with relative times, grouped by day.

Parameters

Name Type Default Description
Card bool true Whether the block draws its own surface (border, background and shadow; only the background in a panels grid). Defaults to true .
Class string Classes added to the root element, merged last so they win over the theme.
Freshness bool? Shows an Updated footer built from Source.UpdatedAt . When null , the value of the enclosing KlyDashboardGrid.Freshness applies, or false outside a grid.
GroupByDay bool true Inserts a heading ( Today , Yesterday or an ISO date) when the day changes. Defaults to true .
Items IReadOnlyList<DashboardFeedItem> The events, in display order. They are not sorted.
Limit int? The maximum number of events shown. The table view and the CSV export hold the same events.
Menu bool? Shows the View as table, Download CSV and Expand buttons in the header once the content is displayed. Download CSV saves the block's table as a CSV file named after the title. When null , the value of the enclosing KlyDashboardGrid.Menu applies, or false outside a grid.
Now DateTimeOffset? The reference moment for the day headings and the relative times. The current UTC time when null ; set it to get deterministic output in tests.
Source IDashboardSource The resource whose state drives the block: a skeleton while it loads, an error message with a retry button, then the content. The block does not read Data from it, so pass the data through the other parameters. Without a source the content renders immediately.
Span int 6 Width of the block in columns of the grid, clamped between 1 and the Columns of the enclosing KlyDashboardGrid (12 outside a grid). Defaults to 6.
Subtitle string A secondary line under the title.
Title string The heading of the block.

KlyDashboardDetails

A definition list of labelled values, with optional hints, links and copy buttons.

Parameters

Name Type Default Description
Card bool true Whether the block draws its own surface (border, background and shadow; only the background in a panels grid). Defaults to true .
Class string Classes added to the root element, merged last so they win over the theme.
Freshness bool? Shows an Updated footer built from Source.UpdatedAt . When null , the value of the enclosing KlyDashboardGrid.Freshness applies, or false outside a grid.
Items IReadOnlyList<DashboardDetailsItem> The definition rows. Rows marked Hidden are skipped, and rows marked Copy get a button that copies the value with navigator.clipboard.writeText , which needs an interactive render mode and a secure context.
Menu bool? Shows the View as table, Download CSV and Expand buttons in the header once the content is displayed. Download CSV saves the block's table as a CSV file named after the title. When null , the value of the enclosing KlyDashboardGrid.Menu applies, or false outside a grid.
Source IDashboardSource The resource whose state drives the block: a skeleton while it loads, an error message with a retry button, then the content. The block does not read Data from it, so pass the data through the other parameters. Without a source the content renders immediately.
Span int 6 Width of the block in columns of the grid, clamped between 1 and the Columns of the enclosing KlyDashboardGrid (12 outside a grid). Defaults to 6.
Subtitle string A secondary line under the title.
Title string The heading of the block.