Componentdata0.37 KB gzipZero dependencies

Rank List

Ranked list with drag-to-reorder and score readouts.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add rank-list

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { RankList } from "@/components/ui/rank-list"; <RankList />

Source code

rank-list.tsx + 2 helpers

Zero third-party dependencies (3 local files shown in tabs below).

tsxrank-list.tsx32 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils";import { DragSort, type DragSortItem } from "./drag-sort"; export interface RankListProps extends React.HTMLAttributes<HTMLDivElement> {  items: { id: string; label: string; score?: number }[];  onReorder?: (items: DragSortItem[]) => void;} /** Leaderboard rank list: drag ranking + score counters. */export function RankList({ items = [], onReorder, className, ...props }: RankListProps) {  const dragItems: DragSortItem[] = items.map((it) => ({    id: it.id,    content: (      <span className="flex items-center justify-between gap-3">        <span className="truncate">{it.label}</span>

Props

PropTypeDescription
items{ id: string; label: string; score?: number }[]Structured list of items rendered by the component. (Default: [])
onReorder(items: DragSortItem[]) => voidCallback invoked on reorder.