Skip to content
fandhe-frontendcore v0.4.3
GitHub

Radio Card

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

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

Demo

chakra-ui radio-card 相当のカード型選択 UI。状態機械は RadioGroup(headless)をそのまま再利用し、data-scope="radio-card" の新規 anatomy でカード外観を重ねます。

Plan
Size

Features

  • size/colorPalette variant クラスを root へ付与し、role="radiogroup" を固定付与する。
  • item/item_control/item_content/item_text/item_description/item_addon/item_indicator/item_hidden_input の各パーツでカード形状の選択肢を構成する。
  • 選択中の item は palette-subtle 背景(--fandhe-palette-subtle)+ palette 枠線で強調される(イシュー #2213)。

Anatomy

root
  label
  item
    item-hidden-input
    item-control
      item-content
        item-text
        item-description
      item-indicator

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 配下の子ノード(通常 item 列)。

Data Attributes

PartAttributeObserved Values
itemdata-disabled(値なし)
itemdata-invalid(値なし)
itemdata-statechecked, unchecked
itemdata-valueplan-enterprise-card, plan-free-card, plan-invalid-card, plan-pro-card, showcase-radio-card-size-lg, showcase-radio-card-size-md, showcase-radio-card-size-sm, showcase-radio-card-size-xl, showcase-radio-card-size-xs
item-controldata-disabled(値なし)
item-controldata-statechecked, unchecked
item-hidden-inputdata-statechecked, unchecked
item-indicatordata-disabled(値なし)
item-indicatordata-invalid(値なし)
item-indicatordata-statechecked, unchecked
rootdata-orientationvertical

CSS Variables

VariableDefault
--fandhe-radio-card-control-size1rem
--fandhe-radio-card-description-font-sizevar(--fandhe-font-font-size-sm)
--fandhe-radio-card-dot-inset3px
--fandhe-radio-card-gapvar(--fandhe-space-2)
--fandhe-radio-card-label-font-sizevar(--fandhe-font-font-size-sm)
--fandhe-radio-card-padding0.75rem