Skip to Content
zjkm-ui
Components

Rich Select

A select whose options carry an icon and a description.

Plan
Props
<RichSelect label="Plan" options={plans} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/rich-select.json
import { 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

PropTypeDefaultDescription
labelstringThe label.
options{ value, label, description?, icon? }[]The choices.
defaultValuestringthe firstStarting choice.
onChange(value: string) => voidCalled when a choice is made.
classNamestringClasses for the wrapper.

It has no animation, so reduced motion changes nothing.

On this page