Key Metrics Block
contentbit/key-metricsFreeComponent
Stat cards for scannable numbers.
Install it
npx shadcn@latest add https://contentbit.dev/r/key-metrics.jsonSource
1import { keyMetricsBlock } from '@contentbit/blocks'2import { defineBlockComponent } from '@contentbit/react'34import { cn } from '@/lib/utils'56// Static map so Tailwind can see the class names.7const COLS: Record<number, string> = {8 1: 'sm:grid-cols-1',9 2: 'sm:grid-cols-2',10 3: 'sm:grid-cols-3',11 4: 'sm:grid-cols-4',12}1314export const KeyMetricsBlock = defineBlockComponent(keyMetricsBlock, ({ node }) => {15 const data = node.data16 const cols = COLS[Math.min(data.rows.length, 4)]17 return (18 <div data-cb-styled className={cn('my-6 grid grid-cols-2 gap-3', cols)}>19 {data.rows.map((row, i) => (20 <div21 key={i}22 className="bg-card relative overflow-hidden rounded-lg border px-4 pt-4 pb-3.5"23 >24 <span25 className="via-foreground/20 absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent to-transparent"26 aria-hidden27 />28 <div className="text-2xl font-bold tracking-tight tabular-nums sm:text-[1.75rem]">29 {row.value}30 </div>31 <div className="text-muted-foreground mt-1 truncate font-mono text-[11px] tracking-wide uppercase">32 {row.label}33 </div>34 </div>35 ))}36 </div>37 )38})
What it pulls in
npm packages
Files it writes
More from contentbit
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Callout Block (Astro)astro-callout | contentbit | Components | Free | 3 deps | |
| Comparison Block (Astro)astro-comparison | contentbit | Components | Free | 3 deps | |
| Content Renderer (Astro)astro-content-renderer | contentbit | Components | Free | 3 deps | |
| FAQ Block (Astro)astro-faq | contentbit | Components | Free | 3 deps | |
| Key Metrics Block (Astro)astro-key-metrics | contentbit | Components | Free | 3 deps | |
| Pros & Cons Block (Astro)astro-pros-cons | contentbit | Components | Free | 3 deps | |
| Quick Reference Block (Astro)astro-quick-ref | contentbit | Components | Free | 3 deps | |
| Steps Block (Astro)astro-steps | contentbit | Components | Free | 3 deps |
