MiniBars
The mock's bars(): the last bar solid, the others at .45; a gap is an empty slot.
import { MiniBars } from '@ergasti/bricks';Examples
Area trend
A filled line over a period with a few x labels. Every chart takes a label (its accessible name) and draws a calm "no data" state for an empty series.
Code
import { AreaTrend } from '@ergasti/bricks';
import { mock } from './sample-data';
function Trend() {
return (
<div style={{ maxWidth: 700, background: 'var(--card)', borderRadius: 22, padding: 16 }}>
<AreaTrend data={mock.SERIES.sales} xLabels={['14 Oct', '28 Oct', '13 Nov']} label="Sales, last 30 days" />
</div>
);
}Spark and mini bars
The small charts that sit inside a tile. A null in the series is a gap.
Code
import { MiniBars, Spark } from '@ergasti/bricks';
import { mock } from './sample-data';
function Small() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 24, alignItems: 'flex-end' }}>
<Spark data={mock.SERIES.sales} tone="lime" label="Sales" />
<Spark data={[...mock.SERIES.roi.slice(0, 10), null, ...mock.SERIES.roi.slice(11)]} tone="sky" label="ROI with a gap" />
<MiniBars data={mock.SERIES.orders.slice(-12)} tone="rasp" label="Orders" />
<Spark data={[]} label="Empty" />
</div>
);
}Tones
tone picks the line and fill colour: lime, rasp, butter or sky.
Code
import { AreaTrend } from '@ergasti/bricks';
import { mock } from './sample-data';
function Tones() {
return (
<div style={{ display: 'grid', gap: 12, gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))' }}>
{(['rasp', 'sky'] as const).map((tone) => (
<div key={tone} style={{ background: 'var(--card)', borderRadius: 22, padding: 16 }}>
<AreaTrend data={mock.SERIES.orders} tone={tone} label={`Orders, ${tone}`} />
</div>
))}
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses MiniBars. Written in docs/content/components/MiniBars.md; the props above are read from the code, which wins where the two disagree.
A small bar chart (120 × 46) for a short run of counts, the last bar solid; use it in a KPI Tile's chart slot.
MiniBars is the mock's bars(): equal-width rounded bars scaled to the series peak, every bar at 45 % opacity except the latest, which is solid so the current period stands out. A null value is an empty slot, not a zero-height bar. Like Spark it fills its box and exposes a hidden table to assistive tech.
Anatomy
- SVG (
svg.kit-spark, viewBox0 0 120 46, stretched,aria-hidden). - Bars: one
rectper known value, 1.5px gutter each side, radius 2, fill in the tone colour, opacity 0.45. - Latest bar: the last item at opacity 1.
- Hidden series table (
.kit-sr): captionlabel, rows 1…n.
Variants
tone | Fill | When |
|---|---|---|
'rasp' (default) | --rasp | Orders |
'lime' | --spark-lime | Sales |
'butter' | --spark-butter | Commission |
'sky' | --sky-ink | ROI |
States
| State | Trigger | Look |
|---|---|---|
| Default | numbers in data | Bars, last one solid |
| Gap | null entry | An empty slot at that position |
| Empty | data=[] | Muted "No data yet" / "لسه مفيش بيانات", no SVG |
| All zero | every value 0 | Peak falls back to 1: all bars zero-height |
Types
Series (data): ReadonlyArray<number | null>.
Usage
<Tile tone="rasp" label="Orders" value="1,284" delta={<Delta value={7.9} />}
chart={<MiniBars data={SERIES.orders.slice(-12)} label="Orders, last 12 days" />} /><div style={{ width: 140, height: 46 }}>
<MiniBars data={[32, 41, 38, null, 47, 52]} label="Orders" tone="rasp" />
</div>Where it appears
- Brand › Home / Analytics › KPI tile chart slot (the mock's
bars()helper, used for count metrics). - Kit gallery; no dedicated screen.
Guidelines
Do
- Use it for discrete counts (orders, claims); use Spark for continuous money or ratios.
- Order oldest → newest so the solid bar is "now".
- Keep 6 to 14 bars; at 120px wider series turn into slivers.
Don't
- Don't use it for negative values; bars grow from the bottom only.
- Don't rely on it for exact numbers; the Tile value carries them.
RTL and Arabic
- Bars do not mirror: newest is always on the right.
- Inside a Tile the slot moves to the inline end (left in Arabic).
Tokens
--rasp, --spark-lime, --spark-butter, --sky-ink (fill per tone), --ink-3 (empty text).
Accessibility
- SVG
aria-hidden; the hidden table lists each value ("—" for gaps) under thelabelcaption. - Not focusable, no hover tips.
Found in the source
- ARIA attributes set:
aria-hidden.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Spark: the line version for the same slot.BarChart: a full-size bar chart with axes and tips.Tile: the host.
See also: AreaTrend · Gauge · HBars
Source
src/kit/patterns/Charts.tsx (line 74) on GitHub.