SortButton

A menu button that sorts a list by a chosen field.

Installation

pnpm dlx shadcn@latest add @chelone/sort-button

A menu button that sorts a list by a chosen field.

Props

PropTypeDefaultDescription
asChildboolean—
fieldsstring[]—
iconReactNode—
labelstring—
refRef<HTMLButtonElement>—Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
resourcestring—
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null—
variant"link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null—