Skip to content
nexubDesign System
v11.9.0

Components · Data Display

Comparison Bar

AlphaAdded v10.7.0

Two values on one split bar, with the numbers always shown as text.

import { ComparisonBar } from '@nexub/react';
View as Markdown

Playground

Props

size
highlight
TSX
<ComparisonBar left={{ label: 'Team A', value: 3 }} right={{ label: 'Team B', value: 1 }} label="Goals" />

Examples

Default

A group of comparisons

States

  • default
  • size="sm"
  • size="md"

Props

Props
PropTypeDefaultDescription
labelrequiredstring—What is compared.
leftrequiredComparisonBarSide—The side at the inline start.
rightrequiredComparisonBarSide—The side at the inline end.
valueFormat((value: number) => string)StringFormats both values, on screen and in the text alternative.
size'sm' | 'md''md'Bar height and type size.
showValuesbooleantrueThe two values and the label above the bar.
showLabelsbooleantrueThe two side labels under the bar. Turn off for all but one bar in a group.
highlight'none' | 'higher''higher'The larger side takes the accent and the other is muted. A side with a color keeps it.
aria-labelstring—Replaces the text alternative built from the props.