HapplyUI

Components

Ranked List

Labels ranked by count, each behind a numbered badge. Pass the rows already in order; the list numbers them as given.


Installation

bunx @happlyui/cli@latest add ranked-list

Dependencies

Registry dependencies

These are automatically installed when you add this component.

  • happly-ui-utils

Usage

import * as RankedList from "@/components/ui/ranked-list"

<RankedList.Root
  items={[{ label: "Category A", value: 3264 }]}
  columnLabels={["Category", "Count"]}
/>

Examples

Default

Four rows spread evenly down the card.

Card title

CategoryCount
  1. Category A3,264
  2. Category B2,731
  3. Category C1,950
  4. Category D1,740
<RankedList.Root items={items} columnLabels={["Category", "Count"]} />

Many rows

Rows past what the card fits scroll inside it. A long label truncates and keeps its full text in a tooltip.

Card title

CategoryCount
  1. Category A3,264
  2. Category B2,731
  3. Category C1,950
  4. Category D1,740
  5. Category E with a much longer name than the rest912
  6. Category F640
  7. Category G215
  8. Category H88
<RankedList.Root items={manyItems} columnLabels={["Category", "Count"]} />

API Reference

RankedList.Root

The list and its header.

PropTypeDefaultDescription
items{ label: string; value: number }[]-Rows in rank order. Not sorted for you
columnLabels[string, string]-Headers over the label column and the value column

Previous
Line Chart