Components
Rich Select
A select whose options carry an icon and a description.
Plan
<RichSelect label="Plan" options={plans} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/rich-select.jsonimport { RichSelect } from "@/components/rich-select"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A dropdown whose options carry an icon and a short description. It's a button that opens a listbox, with the keys you'd expect: arrows, Home, End, Enter, Space and Escape.
import { HugeiconsIcon } from "@hugeicons/react";
import { Plant02Icon, UserGroupIcon } from "@hugeicons/core-free-icons";
import { RichSelect } from "@/components/rich-select";
const plans = [
{ value: "hobby", label: "Hobby", description: "For side projects", icon: <HugeiconsIcon icon={Plant02Icon} size={20} /> },
{ value: "team", label: "Team", description: "Up to 10 people", icon: <HugeiconsIcon icon={UserGroupIcon} size={20} /> },
];
export function Plan() {
return <RichSelect label="Plan" options={plans} />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
options | { value, label, description?, icon? }[] | The choices. | |
defaultValue | string | the first | Starting choice. |
onChange | (value: string) => void | Called when a choice is made. | |
className | string | Classes for the wrapper. |
It has no animation, so reduced motion changes nothing.