Skip to content
fandhe-frontend
GitHub

Listbox

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

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

Demo

headless-ui の Listbox(role="listbox")に pre-styled-ui の recipe CSS を適用した静的掲示です。Select(ポップアップ型)と異なり trigger/positioner を持たず、常時展開のリストとして表示されます。左は single モード(1 項目選択済み、1 項目 disabled)、右は multiple モード(aria-multiselectable、複数項目選択済み・item-group 付き)です。

Apple
Banana (disabled)
Cheese
Cheddar
Mozzarella

Features

  • headless-ui の `listbox::root` へ委譲し、`size` variant クラスを付与する。
  • `selection_state`(`OpenState`)・`disabled` の 2 軸を直接引数で受け取る。

Anatomy

root
  label
  content
    item
      item-text
      item-indicator
    item-group
      item-group-label

API Reference

Arguments

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

Data Attributes

PartAttributeObserved Values
itemdata-disabled
itemdata-stateclosed, open
itemdata-valueapple, banana, cheddar, mozzarella
item-indicatordata-stateclosed, open
rootdata-stateopen

CSS Variables

VariableDefault
--fandhe-listbox-content-max-height16rem
--fandhe-listbox-content-paddingvar(--fandhe-space-2)
--fandhe-listbox-item-paddingvar(--fandhe-space-2) var(--fandhe-space-3)