# Blazor Status Bar

URL: https://flexcoreui.com/demo/status-bar  
Section: Components  
Controls: StatusBarControl, StatusBarPanel  
Keywords: status bar, status strip, footer bar, panels

A Blazor status bar for the foot of a window: connection, save state, counts and totals, from a list of panels or your own markup.

## Documentation

### Parameters

| Name | Type | Default | Description |
|---|---|---|---|
| Panels | List<StatusBarPanel>? | null | Panels drawn in order, each an icon and a line of text. |
| ChildContent | RenderFragment? | null | Your own markup, placed after the panels. It takes this page's styles, not the control's. |
| CssClass | string? | null | Appended after fx-statusbar. The control has no Style and accepts no other attributes. |

### Panel

| Name | Type | Default | Description |
|---|---|---|---|
| Text | string? | null | The panel's text. Cut with an ellipsis when a Width or Spring panel is too narrow; other panels keep their full width and are clipped at the bar's edge. |
| IconCss | string? | null | Classes for an icon before the text, such as bi bi-wifi. |
| Tooltip | string? | null | Native title of the panel. Not a constructor argument; set it in an initializer. |
| Width | string? | null | Fixed CSS width, for example 92px. Ignored when Spring is true. |
| Spring | bool | false | The panel takes all the spare width. |
| ctor |  |  | new(text, iconCss, width, spring), all but text optional. |

### Css

| Name | Description |
|---|---|
| fx-statusbar | The bar: a 28px flex row with a gray fill and a top border. |
| fx-statusbar-panel | One panel: padded, with a right border except on the last. |
| fx-statusbar-spring | Added to a Spring panel; it grows to fill the row. |
| fx-statusbar-icon · fx-statusbar-text | The icon and the text inside a panel. |

## Examples

### Panels

```razor
@using Fx.ControlKit

<div class="sb-frame">
    <div class="sb-chrome" aria-hidden="true"><span></span><span></span><span></span></div>
    <div class="sb-body">
        <strong>Receiving PO-2291, Dock 2, Road freight</strong>
        <TextBoxControl Value="@_notes" ValueChanged="NotesChanged" UpdateOnInput="true" Width="100%" Placeholder="Notes for the putaway team" aria-label="Notes for the putaway team" />
        <div class="demo-row">
            <ButtonControl CssClass="btn-primary btn-sm" IconCss="bi bi-save" Disabled="@(!_dirty || !_online)" OnClick="Save">Save</ButtonControl>
            <ButtonControl CssClass="btn-sm" OnClick="ToggleOnline">@(_online ? "Go offline" : "Go online")</ButtonControl>
        </div>
    </div>
    <StatusBarControl Panels="_panels" CssClass="@(_online ? null : "sb-offline")" />
</div>
```

```csharp
// Panels
private bool _online = true, _dirty;
private int _saves;
private string? _notes = "Two cartons of headlamps arrived dented.";
private readonly List<StatusBarPanel> _panels = new()
{
    new("Online", "bi bi-wifi", width: "92px") { Tooltip = "Connection to the warehouse system" },
    new("No changes", spring: true),
    new("4 lines", "bi bi-box-seam"),
    new("USD", width: "48px") { Tooltip = "Order currency" },
};
private void NotesChanged(string? text)
{
    _notes = text;
    _dirty = true;
    _panels[1].Text = "Unsaved changes";
}
private void Save()
{
    _dirty = false;
    _panels[1].Text = $"Saved {++_saves} time{(_saves == 1 ? "" : "s")}";
}
private void ToggleOnline()
{
    _online = !_online;
    _panels[0].Text = _online ? "Online" : "Offline";
    _panels[0].IconCss = _online ? "bi bi-wifi" : "bi bi-wifi-off";
}
```

### Content

```razor
@using Fx.ControlKit

<div class="sb-frame">
    <div class="sb-chrome" aria-hidden="true"><span></span><span></span><span></span></div>
    <div class="sb-body sb-list">
        @foreach (var line in _lines)
        {
            <CheckBoxControl @bind-Checked="line.Received" Label="@($"{line.Name}, {line.Amount:C0}")" />
        }
    </div>
    <StatusBarControl Panels="_who">
        <div class="sb-panel sb-spring">
            <span><strong>@ReceivedLines.Count()</strong> of <strong>@_lines.Count</strong> lines received</span>
        </div>
        <div class="sb-panel">Total received: <strong>@ReceivedLines.Sum(l => l.Amount).ToString("C0")</strong></div>
    </StatusBarControl>
</div>
```

```csharp
// Live content
private sealed class OrderLine
{
    public string Name { get; init; } = "";
    public decimal Amount { get; init; }
    public bool Received { get; set; }
}
private readonly List<OrderLine> _lines = new()
{
    new() { Name = "Headlamps", Amount = 1240, Received = true },
    new() { Name = "Camping stoves", Amount = 2890 },
    new() { Name = "Rain jackets", Amount = 6150, Received = true },
    new() { Name = "Water bottles", Amount = 1980 },
};
private IEnumerable<OrderLine> ReceivedLines => _lines.Where(l => l.Received);
private readonly List<StatusBarPanel> _who = new() { new("Received by Albus Door", "bi bi-person", width: "190px") };
```

