Skip to content
Klarhimmel UI

Stats, columns

Stats, columns previewStats, columns preview

Install

npx shadcn add https://ui.klarhimmel.com/r/stats-columns.json
DetailsAbout, usage, props and more

A heading on the left with a short note on the right, then three to eight vertical bars on a baseline, each with its value above and its label under.

Import

Import

import Block from '@/components/klarhimmel/blocks/stats-columns';
Also called
  • stats/columns
About
A heading on the left with a short note on the right, then three to eight vertical bars on a baseline, each with its value above and its label under.
Category
A few numbers that prove the point. New project? Set it up once: /get-started/installation.

Notes

When to use it

A heading on the left with a short note on the right, then three to eight vertical bars on a baseline, each with its value above and its label under. Use stats-bars for a ranked list and stats-row for plain numbers.

Writing for it

- Write each value as text, since the first number in it sets the bar height against the largest in the list. - Label each bar with its period or category, such as a weekday, so the row reads like a small chart. - Use the note for the source or the time span, and keep it to a sentence.

Watch out for

Bars scale to the largest value, so one outlier flattens the rest. On a phone the bars keep their row but get narrower, so eight bars with long labels crowd.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import StatsColumns from '@/components/klarhimmel/blocks/stats-columns';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <StatsColumns props={{
          "title": "Say what the bars measure over time",
          "note": "Say in a few words the period and the unit.",
          "items": [
            {
              "label": "Name 1",
              "value": "70"
            },
            {
              "label": "Name 2",
              "value": "64"
            },
            {
              "label": "Name 3",
              "value": "58"
            },
            {
              "label": "Name 4",
              "value": "52"
            },
            {
              "label": "Name 5",
              "value": "46"
            },
            {
              "label": "Name 6",
              "value": "40"
            },
            {
              "label": "Name 7",
              "value": "34"
            }
          ]
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
titlestring'Say what the bars measure over time'Text, up to 80 characters.
notestring'Say in a few words the period and t…'Text, up to 80 characters.
items{ label, value }[]7 itemsList of 3 to 8. Each item: label, value.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.