Sortable Header

Sortable table header button that shows an up, down or neutral arrow for the current sort direction and calls onToggle on click. Pairs with any Tailwind table.

src/registry/ui/sortable-header.tsx/r/sortable-header.json

Installation#

bash
npx shadcn@latest add @minidev/sortable-header

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/sortable-header.json

Usage#

tsx
import { SortableHeader } from "@/components/ui/sortable-header"

export function Example() {
  return <SortableHeader />
}

API reference#

SortableHeader props
PropTypeDefault
label*string-
direction"asc" | "desc" | false-
onToggle() => void-
classNamestring-

* required

Dependencies#

npm

lucide-react

Built from

No other MiniDev files
All data table components

Learn more