Skip to content
fandhe-frontend
GitHub

Button

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

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

Demo

variant(solid / outline / ghost / subtle)・size・colorPalette・状態(disabled / loading)の各軸を型安全な props で切り替えます。IconButton / CloseButton(イシュー #830)は独立部品ではなく本 recipe の icon-only 修飾 variant です。

Features

  • 見た目 variant(`Solid`/`Outline`/`Ghost`/`Subtle`)・サイズ・colorPalette の 3 軸を持つ単一 recipe styled 部品。
  • `loading: true` のとき `disabled` と同様に `disabled` 属性・`data-disabled`・`aria-disabled="true"` を付与し、`aria-busy="true"` を追加する。
  • `loading: true` のとき装飾用途の Spinner(`role`/`aria-label` を持たない)を子ノード先頭へ自動挿入する。
  • `button`/`icon_button`/`close_button` の 3 公開関数が共通の組み立てロジックを共有する(イシュー #830)。

Anatomy

root

API Reference

Arguments

NameTypeDefaultDescription
props&ButtonProps`variant`(既定 `Solid`)・`size`(既定 `Md`)・`palette`(既定 `Accent`)・`disabled`・`loading` を束ねる構造体。
attrsVec<(&str, &str)>`<button>` へ合成する追加属性。
childrenVec<Node>ボタンラベルとなる子ノード。

Data Attributes

PartAttributeObserved Values
rootdata-disabled
rootdata-loading