Skip to content
fandhe-frontendcore v0.4.3
GitHub

Radio Group

fandhe-frontend-pre-styled-ui の radio_group mod が提供するスタイル済み Radio Group 部品です。

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

Demo

単一選択の選択肢グループ。ネイティブ input[type="radio"] による排他選択・キーボード操作を data-scope="radio-group" の anatomy へ重ねます。

Plan
Plan (horizontal)
Plan (invalid)
Size
xs
sm
md
lg
xl

Features

  • size/colorPalette variant クラスを root へ付与し、headless-ui の radio_group::root へ委譲する。
  • aria-checked は各アイテムへ重複付与しない(二重読み上げ防止)。グループ全体の関連付けは root の aria-labelledby で行う。

Anatomy

root
  label
  item
    item-hidden-input
    item-control
    item-text

API Reference

Arguments

NameTypeDefaultDescription
sizeSizeSize::Mdサイズ variant。
paletteColorPaletteColorPalette::AccentcolorPalette 軸。
disabledboolfalseグループ全体の無効化状態。
orientationOption<Orientation>Noneキーボード操作方向のヒント(aria-orientation)。
labelled_byOption<&str>NoneSome のとき aria-labelledby を付与する。
attrsVec<(&str, &str)>—root パーツへ合成する追加属性。
childrenVec<Node>—root 配下の子ノード。

Data Attributes

PartAttributeObserved Values
itemdata-disabled(値なし)
itemdata-invalid(値なし)
itemdata-statechecked, unchecked
itemdata-valueplan-enterprise, plan-free, plan-pro
item-controldata-disabled(値なし)
item-controldata-invalid(値なし)
item-controldata-statechecked, unchecked
item-hidden-inputdata-statechecked, unchecked
item-textdata-disabled(値なし)
item-textdata-invalid(値なし)
item-textdata-statechecked, unchecked
labeldata-invalid(値なし)
rootdata-invalid(値なし)
rootdata-orientationhorizontal, vertical

CSS Variables

VariableDefault
--fandhe-radio-group-control-size1rem
--fandhe-radio-group-dot-inset3px
--fandhe-radio-group-font-sizevar(--fandhe-font-font-size-sm)
--fandhe-radio-group-gapvar(--fandhe-space-1)
--fandhe-radio-group-item-gapvar(--fandhe-space-2)
--fandhe-radio-group-label-basisauto

Examples

説明文付き(label + description の合成)

radio_group は description 専用パートを持たない(headless anatomy に存在せず、chakra-ui も同様に呼び出し側合成のため。fandhe_frontend_pre_styled_ui::radio_group rustdoc「shadcn/ui との突合」節参照)。item-text の後ろへ通常の子ノードとして fg-muted + 1 段小さいフォントサイズの説明文を並べるだけで再現できます。

Notifications

Accessibility

WAI-ARIA

AttributeDescription
aria-labelledbylabelled_by が Some のときのみ root へ付与する。
aria-orientationorientation が Some のとき root へ data-orientation と対で付与する。