` spans.
- Use `Alert` inside a page's optional error slot rather than always rendering it — pass an empty byte array (`[]`) when there is no error so the slot renders nothing.
---
## Complete page example
**`Templates/SystemStatusPage.htmx`**
```html
System Status
$$MaintenanceAlert$$
$$DatabaseAlert$$
$$ApiAlert$$
```
**`Templates/SystemStatusPage.htmx.cs`**
```csharp
namespace Htmx.ApiDemo.Templates;
public sealed class SystemStatusPage : SystemStatusPageBase
{
private readonly IHtmxComponent _maintenance;
private readonly IHtmxComponent _database;
private readonly IHtmxComponent _api;
public SystemStatusPage(bool maintenanceScheduled, bool dbDegraded, bool apiOk)
{
_maintenance = maintenanceScheduled
? new Components.Alert(
title: "Scheduled maintenance",
description: "The service will be unavailable on Saturday 00:00–02:00 UTC.",
variant: "default")
: HtmxEmpty.Instance;
_database = dbDegraded
? new Components.Alert(
title: "Database degraded",
description: "Query latency is elevated. Our team is investigating.",
variant: "destructive")
: HtmxEmpty.Instance;
_api = apiOk
? new Components.Alert(title: "All systems operational.")
: HtmxEmpty.Instance;
}
protected override void RenderMaintenanceAlert(HtmxRenderContext ctx)
=> _maintenance.Render(ctx.Next());
protected override void RenderDatabaseAlert(HtmxRenderContext ctx)
=> _database.Render(ctx.Next());
protected override void RenderApiAlert(HtmxRenderContext ctx)
=> _api.Render(ctx.Next());
}
```
**GET handler**
```csharp
[Handler]
[MapGet("/status")]
public static partial class GetSystemStatusHandler
{
public record Query();
private static Task HandleAsync(
Query _,
HttpContext ctx,
CancellationToken ct)
{
var page = new SystemStatusPage(
maintenanceScheduled: true,
dbDegraded: false,
apiOk: true);
return ctx.WriteHtmxPage(page, title: "System Status");
}
}
```