121 Pro components and page blocks

Get Pro

Benchmark Race

New

Preview

Customize

Color
Duration0.9s

Installation

npx shadcn@latest add https://uibrik.com/r/benchmark-race.json
Adds the files to components/uibrik/benchmark-race and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/benchmark-race.

Usage

import { BenchmarkRace } from "@/components/uibrik/benchmark-race/benchmark-race";​<BenchmarkRace  highlight="Acme"  color="#2563eb"  duration={0.9}  sort  shine  showLead  defaultIndex={0}  locale="en-US"  onIndexChange={(index) => {}}  // benchmarks={[{ label: "…", results: [{ name: "…", value: 0 }] }]}  // index={0}/>

Where to use Benchmark Race

  • Performance comparisons

    Bars racing to their results with counting numbers make benchmarks exciting.

    Pairs with Comparison Table

  • Speed against competitors

    Tabs switching the measure show wins across several metrics.

  • Benchmark pages

    Rows re-sorting so the best leads make the winner obvious.

    Pairs with Performance Meter

Props

BenchmarkRace
highlight
Type string
"Acme"
Name of your own result, drawn in the accent colour.
color
Type string
"#2563eb"
Accent for your logo, bar and lead chip. Every other row stays neutral.
duration
Type number
0.9
How long a bar takes to reach its result the first time.
sort
Type boolean
true
Order rows by result; they trade places when the measure changes.
shine
Type boolean
true
A shine passes along your bar each time it lands.
showLead
Type boolean
true
Show how far ahead you are of the best of the others, e.g. "3.1× faster".
benchmarks
Type { label: string; unit?: string; lowerIsBetter?: boolean; better?: string; caption?: string; results: { name: string; value: number; logo?: ReactNode; color?: string }[] }[]
3 measures
One tab per measure. better is the word after the lead multiplier (faster, smaller, more). logo is a mark drawn in currentColor on a small tile; color is the brand colour its tile and bar take on hover. One measure hides the tabs.
index / defaultIndex
Type number
0
Selected measure, controlled or uncontrolled.
onIndexChange
Type (index: number) => void
–
Called when a tab is picked.
locale
Type string
"en-US"
Locale for number formatting.
className
Type string
–
Classes for the card.