Components / Motion
Stats Bento
A bento grid of numbers that spring up from zero when it scrolls into view. Tiles can span columns, rows or both.
since day one
18
Products shipped
4.9
Average rating
12
Years building
past 90 days
120k
Monthly visitors
96%
Uptime this year
7
Open source repos
Installation
npx shadcn@latest add https://jiaweing.com/r/stats-bento.jsonWith the @jiaweing namespace set up, use @jiaweing/stats-bento in place of the URL.
Usage
tsx
import { StatsBento } from "@/components/stats-bento";tsx
<StatsBento
items={[
{ value: 18, label: "Products shipped", size: "hero" },
{ value: 4.9, decimals: 1, label: "Average rating" },
{ value: 120, suffix: "k", label: "Monthly visits", size: "wide" },
]}
/>Props
StatsBento
| Prop | Type | Default | Description |
|---|---|---|---|
| items | StatsBentoItem[] | - | The tiles, in order. |
| rowHeight | number | 160 | Row height in pixels. |
| className | string | - | Extra classes, merged with cn. |
StatsBentoItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | - | The number the tile springs up to. |
| label | string | - | What it counts. |
| sublabel | string | - | A small line next to the icon. |
| icon | ReactNode | - | Top left icon. |
| prefix / suffix | string | - | Text around the number. |
| decimals | number | 0 | Digits after the decimal point. |
| href | string | - | Makes the tile a link. External links open in a new tab. |
| size | "default" | "wide" | "tall" | "hero" | "default" | wide spans two columns, tall two rows, hero both. |
MIT licensed. Copy it, change it, ship it.