FormComboboxField
ComboboxField
コンボボックスフィールドコンポーネント
概要
検索可能なドロップダウンフィールド。onSearch でサーバーサイド検索にも対応。
Props
| Prop | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
label | string | Yes | — | フィールドラベル |
options | { label: string; value: string }[] | Yes | — | 選択肢 |
description | string | — | — | ヘルパーテキスト |
error | string | — | — | エラーメッセージ |
value | string | — | — | 選択値 |
onValueChange | (value: string) => void | — | — | 選択コールバック |
onSearch | (query: string) => void | — | — | 検索コールバック |
placeholder | string | — | — | プレースホルダー |
loading | boolean | — | false | ローディング表示 |
emptyMessage | string | — | "結果が見つかりません" | 空メッセージ |
disabled | boolean | — | — | 無効化 |
使用例
import { ComboboxField } from "@unitto/ui";
<ComboboxField
label="都道府県"
placeholder="検索..."
options={[
{ label: "東京都", value: "tokyo" },
{ label: "大阪府", value: "osaka" },
{ label: "北海道", value: "hokkaido" },
]}
onValueChange={(value) => console.log(value)}
/>