Componentdata0.37 KB gzipZero dependencies
Rank List
Ranked list with drag-to-reorder and score readouts.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add rank-listOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { RankList } from "@/components/ui/rank-list"; <RankList />Source code
rank-list.tsx + 2 helpersZero 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
| Prop | Type | Description |
|---|---|---|
| items | { id: string; label: string; score?: number }[] | Structured list of items rendered by the component. (Default: []) |
| onReorder | (items: DragSortItem[]) => void | Callback invoked on reorder. |