Skip to main content
brickwork
GitHub Log in Get started
Display
Theme
Density
Direction
Brand

Documentation

Stat

A KPI tile with value, optional comparison and optional sparkline.

All components Component Brickwork 4.3.1

Try it

Revenue metric

Open full-page preview

A positive revenue comparison.

Revenue £42,100 increased 12% on last month
Use for a single headline metric in a dashboard.

Use it

Working invocation

This code creates the configuration shown above. Copy the template and the required Python context together.

templates/your_app/component.html

Django template

{% include "brickwork/components/_stat.html" with label="Revenue" value="£42,100" trend="up" trend_label="12% on last month" sentiment="good" %}

your_app/views.py

Python

context = {}

Guide

Add it to your project

  1. Include with label and formatted value.
  2. Use `trend` with `trend_label` to communicate comparison; compose `trend_indicator` for standalone use.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
label string Not set Yes Metric name. Constraint: Use concise visible text that identifies the control or measurement.
value string Not set Yes Already formatted metric value. Constraint: Use the same type and scale expected by the receiving form or measurement.
trend string Not set No Direction. Allowed: up, down, flat. Constraint: Allowed values: `up`, `down`, `flat`.
trend_label string Not set No Visible comparison wording. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
sentiment string Not set No Optional judgement colour. Allowed: good, bad. Constraint: Allowed values: `good`, `bad`.
icon registered icon name Not set No Leading flat glyph. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
href string Not set No Makes tile a real anchor. Constraint: Use a valid navigable URL and do not combine it with submit-only button fields.
loading boolean False No Skeleton state. Constraint: Use only for a temporary loading state and replace it with real or error content.
size string md No Tile scale. Allowed: sm, md, lg. Constraint: Use one of the documented size choices; unsupported values are not a responsive substitute.
chrome string card No Surface treatment. Allowed: card, plain. Constraint: Allowed values: `card`, `plain`.
data mapping Not set No Consumer-owned data-* attributes. Constraint: Use the component's documented structured data shape; it is not a scalar visitor control.
sparkline safe HTML Not set No Trusted pre-rendered visualisation markup; ignored while loading. Constraint: Pass trusted pre-rendered sparkline markup from the paired component; never inject request text as HTML.

Behaviour

Accessibility and responsive behaviour

Accessibility
Trend text and hidden direction prevent colour-only meaning.
Responsive
Tile responds as part of its parent grid.
Without JavaScript
Server-rendered metric.

Need help?

Troubleshooting

Contract check: brickwork does not validate URL schemes; href values are emitted as

Validate user-supplied `href` values before rendering a linked stat; Brickwork emits the URL as given.

Explore next

Used in examples

Documentation