import { useState } from "react"; import { Avatar, AvatarFallback, Badge, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@godxjp/ui/data-display"; import { FormField, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, } from "@godxjp/ui/data-entry"; import { Button } from "@godxjp/ui/general"; import { Flex, PageContainer } from "@godxjp/ui/layout"; import { X } from "lucide-react"; /** * Select — the single-select control. Prefer the data-driven `options` API * (handles search, grouping, async); compose sub-parts only for a custom * trigger. Never a raw Searchable + grouped showSearch enables client-side filtering; group buckets options. Option icon · shown on the trigger too Give each option an `icon` (avatar / flag / lucide icon). It renders before the label in the list AND on the trigger once selected, with no `renderOption` needed. Empty options · trigger disabled A static `options={[]}` list has nothing to pick, so the trigger disables itself and never opens a blank popover. Provide options (or an async loadOptions) to enable it. Custom rows (renderOption) `renderOption` (like Ant's optionRender) draws a fully custom row: avatar + name + email + a status badge. Use a flex ROW (`div className="flex items-center"`), not a bare `Flex` which defaults to a column. ( {avatarFor(String(label))} {label} 担当 )} /> Compound API (custom trigger) Compose sub-parts when the trigger needs custom content. SelectTrigger accepts size "sm" and "md"; "md" is the default and matches Input height in a form, "sm" fits a dense toolbar or table header. 複数選択・上限・検索 最大 3 件を選択。選択行の再クリック・クリア・キーボード操作に対応。 ¥} placement="bottomEnd" listHeight={220} options={[ { label: "アジア", options: [ { value: "JPY", label: "日本円" }, { value: "VND", label: "ベトナムドン" }, ], }, { label: "ヨーロッパ", options: [{ value: "EUR", label: "ユーロ" }], }, ]} /> mode="tags" · tokenSeparators・tagRender 一覧にない値も入力できます。カンマ区切りの貼り付けは一度にまとめて確定します。 ); }