Skip to content
fandhe-frontend
GitHub

Radio Group

fandhe-frontend-pre-styled-uiradio_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

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>None`Some` のとき `aria-labelledby` を付与する。
attrsVec<(&str, &str)>root パーツへ合成する追加属性。
childrenVec<Node>root 配下の子ノード。

Data Attributes

PartAttributeObserved Values
itemdata-disabled
itemdata-statechecked, unchecked
itemdata-valueplan-enterprise, plan-free, plan-pro
item-controldata-disabled
item-controldata-statechecked, unchecked
item-hidden-inputdata-statechecked, unchecked
item-textdata-disabled
item-textdata-statechecked, unchecked
rootdata-orientationvertical

CSS Variables

VariableDefault
--fandhe-radio-group-control-size1rem
--fandhe-radio-group-dot-inset3px
--fandhe-radio-group-font-sizevar(--fandhe-font-font-size-sm)

Accessibility

WAI-ARIA

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