Select
One choice in a list that opens below: icons, hints, typeahead.
import { SelectMenu } from "@forgeron/ui";Stage
import { SelectMenu } from "@forgeron/ui";
const stages = [
{ value: "new", label: "New" },
{ value: "qualified", label: "Qualified" },
{ value: "proposal", label: "Proposal" },
{ value: "won", label: "Won" },
{ value: "lost", label: "Lost" },
];
export default function Default() {
return <SelectMenu label="Stage" showLabel options={stages} placeholder="Choose a stage" />;
}Status
Assignee
import {
AlertSquareIcon,
CheckmarkCircle01Icon,
CircleIcon,
Loading03Icon,
UserIcon,
} from "@forgeron/icons";
import { SelectMenu } from "@forgeron/ui";
import { useState } from "react";
const statuses = [
{ value: "todo", label: "Todo", icon: CircleIcon, hint: "1" },
{ value: "progress", label: "In Progress", icon: Loading03Icon, hint: "2" },
{ value: "review", label: "In Review", icon: AlertSquareIcon, hint: "3" },
{ value: "done", label: "Done", icon: CheckmarkCircle01Icon, hint: "4" },
];
const people = [
{ value: "hb", label: "Hugo Bernard", icon: UserIcon },
{ value: "np", label: "Nadia Petit", icon: UserIcon },
{ value: "lm", label: "Léa Martin", icon: UserIcon },
];
export default function Properties() {
const [status, setStatus] = useState<string | null>("review");
return (
<>
<SelectMenu
label="Status"
variant="chip"
options={statuses}
value={status}
onChange={setStatus}
/>
<SelectMenu label="Assignee" variant="chip" options={people} defaultValue="hb" />
</>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Names the control. |
showLabel | boolean | — | Writes the label above. |
options | { value, label, icon?, hint?, disabled? }[] | — | The choices. |
value / defaultValue | string | null | — | Controlled or not. |
onChange | (value: string | null) => void | — | On a new choice. |
variant | "field" | "chip" | "field" | A form control, or a property chip. |
size | "sm" | "md" | "md" | The field at 32px, or 26px in a dense row or a popover. |
placeholder | string | "Choose…" | While nothing is chosen. |
className | string | — | Extra classes. |