コンポーネント
ラジオボタングループ
選択肢の中から1つだけ選べるセット。
使い方
基本
HTML
<bs:bsui-radio-group defaultValue="pro">
<bs:bsui-radio value="free" label="Free" />
<bs:bsui-radio value="pro" label="Pro" />
<bs:bsui-radio value="enterprise" label="Enterprise" />
</bs:bsui-radio-group>水平方向
向きを設定すると、短い選択肢リストが横並びになります。
HTML
<bs:bsui-radio-group name="priority" defaultValue="normal" orientation="horizontal">
<bs:bsui-radio value="low" label="Low" />
<bs:bsui-radio value="normal" label="Normal" />
<bs:bsui-radio value="urgent" label="Urgent" />
</bs:bsui-radio-group>選択できないオプション
グループ内の1つの選択肢だけを無効にし、ほかは引き続き使えるようにできます。
HTML
<bs:bsui-radio-group name="plan" defaultValue="pro">
<bs:bsui-radio value="free" label="Free" />
<bs:bsui-radio value="pro" label="Pro" />
<bs:bsui-radio value="enterprise" label="Enterprise, contact sales" disabled="true" />
</bs:bsui-radio-group>フィールド内
ラベル、ヘルプテキスト、エラーは個々の選択肢ではなく、グループ全体に付きます。
HTML
<bs:bsui-field invalid="true">
<bs:bsui-field-label text="Where should backups live?" />
<bs:bsui-radio-group name="backups">
<bs:bsui-radio value="eu" label="Europe" />
<bs:bsui-radio value="us" label="United States" />
</bs:bsui-radio-group>
<bs:bsui-field-description text="This cannot be changed after the first backup runs." />
<bs:bsui-field-error text="Pick a region to enable backups." />
</bs:bsui-field>構造
ラジオボタングループは以下のブロックで構成されます。それぞれ独立したブロックで、親の内部でのみレンダリングされます。
bsui/radio-groupbsui/radio
属性
| 属性 | タイプ | デフォルト |
|---|---|---|
defaultValue | text | — |
name | text | — |
disabled | toggle | false |
orientation | vertical | |
nameAlt | text | — |
onChange | text | — |
value | text | — |
bsui/radio
| 属性 | タイプ | デフォルト |
|---|---|---|
value | text | — |
label | richtext | — |
disabled | toggle | false |
bindText | text | — |