Skip to content
fandhe-frontend
GitHub

Combobox

fandhe-frontend-pre-styled-uicombobox mod が提供するスタイル済み Combobox 部品です。

関連 API: fandhe-frontend-pre-styled-ui API / fandhe-frontend-headless-ui API

Demo

headless-ui の Combobox(role="combobox")に pre-styled-ui の recipe CSS を適用した静的掲示です。入力値 "re" による filter_options の絞り込み結果を候補として表示しています。positioner はフロー内配置へ中和しています。

React

Features

  • headless-ui の `combobox::root` へ委譲し、`size` variant クラスのみを付与する。
  • 開閉状態は `OpenState`(`Open`/`Closed`)で受け取る。

Anatomy

root
  label
  control
    input
    trigger
  positioner
    content
      item
        item-text

API Reference

Arguments

NameTypeDefaultDescription
sizeSizeSize::Mdサイズ variant。
stateOpenStateOpenState::Closed開閉状態。
attrsVec<(&str, &str)>root パーツへ合成する追加属性。
childrenVec<Node>root 配下の子ノード。

Data Attributes

PartAttributeObserved Values
contentdata-stateopen
controldata-stateopen
inputdata-stateopen
itemdata-stateclosed
itemdata-valuereact
positionerdata-stateopen
rootdata-stateopen
triggerdata-stateopen

CSS Variables

VariableDefault
--fandhe-combobox-content-paddingvar(--fandhe-space-2)
--fandhe-combobox-control-paddingvar(--fandhe-space-1) var(--fandhe-space-2)
--fandhe-combobox-input-paddingvar(--fandhe-space-1) var(--fandhe-space-2)
--fandhe-combobox-item-paddingvar(--fandhe-space-2) var(--fandhe-space-3)