# Stats, bars

- **[Sections](/blocks/)**
- **[Stats](/blocks/stats/)**
- **Stats, bars**

Two to six measures as labelled horizontal bars with the value at the end.

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/stats-bars
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/stats-bars';
  ```

Also called

- stats/bars

- **About**: Two to six measures as labelled horizontal bars with the value at the end. The bar length is the number in `value` (0 to 100, any step: 4% draws 4%; the old `fill` prop is ignored); use it for shares and rates, not for raw counts.
- **Category**: A few numbers that prove the point. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: Two to six measures as labelled horizontal bars, for shares and rates such as satisfaction or uptime. Use `stats-rings` for a few percentages as circles, and `stats-row` for raw counts.
- **Writing for it**: - The first number in value (20 characters) is the bar length from 0 to 100, so write '62%' or '4,5 %'. A value of '4.5' draws a bar of 4.5 percent.
- Use the 100 character note under a bar to say how the number was measured, for instance the period and the sample.
- Put the labels in a consistent order, such as largest first, because the bars are stacked with the same width and compare by eye.
- **Watch out for**: A value with no number in it, like 'High', draws no bar at all, only the text. The old fill prop is ignored, so setting it does nothing.

## Pairs well with

- **[Report, key figures](/blocks/report/stats)**
- **[Features, alternating](/blocks/features/alternating)**
- **[Call to action, band](/blocks/cta/banner)**

## 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 StatsBars from '@/components/klarhimmel/blocks/stats-bars';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <StatsBars props={{
          "eyebrow": "Name the section",
          "title": "Say what the shares divide",
          "description": "Say what the shares are of and across how many.",
          "items": [
            {
              "label": "Name the first share",
              "value": "00%",
              "note": "Say how it changed."
            },
            {
              "label": "Name the second share",
              "value": "00%",
              "note": "Say how it changed."
            },
            {
              "label": "Name the third share",
              "value": "00%",
              "note": "Say who it is mostly made up of."
            },
            {
              "label": "Name the last",
              "value": "00%",
              "note": ""
            }
          ]
        }} />
      </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.

- **eyebrow**: Text, up to 60 characters.
- **title**: Text, up to 120 characters.
- **description**: Text, up to 300 characters.
- **items**: List of 2 to 6. Each item: label, value, note.
- **headingLevel**: One of '1', '2'. Optional; empty is not rendered.

[Previous](/blocks/stats/band)

[Next](/blocks/stats/cards)
