Skip to content

StatsRail

Horizontal/vertical stat selector with animated indicator.

Props

StatsRailProps

PropTypeDefaultDescription
itemsStatsItem[]RequiredStat items
activeIdstring-Controlled active item
defaultActiveIdstringFirst itemInitial active item
onChange(id: string) => void-Selection change handler
renderItem(item, state) => ReactNode-Custom item renderer
breakpoint'md' | 'lg' | 'xl' | '2xl''md'Responsive breakpoint
ariaLabelstring-Navigation aria-label
classNamestring-Container class

StatsItem

PropertyTypeRequiredDescription
idstringYesUnique identifier
labelstringYesStat label
valuestring | numberYesStat value
hintstringNoAdditional context
deltastringNoChange indicator
iconReactNodeNoOptional icon
tostringNoNavigation link

StatsRailRenderState

PropertyTypeDescription
activebooleanWhether item is active
onClick() => voidClick handler
tabIndexnumberTab index

Example

tsx
<StatsRail
  items={[
    { id: 'users', label: 'Users', value: '1,234', delta: '+12%' },
    { id: 'revenue', label: 'Revenue', value: '$45K' },
  ]}
  onChange={(id) => setActiveMetric(id)}
/>

See also