Radio Group
1 つの名前と値を共有するネイティブのラジオボタンのグループ。矢印キーと 1 つの Tab ストップを備え、フォームコントロールとして使えます。
Angular: 対応 Vue: 対応 React: 対応 React Native: 対応
使い方
<fieldset soneRadioGroup [(value)]="density" style="max-width: 26rem">
<legend soneFieldLegend variant="label">Density</legend>
<div soneField orientation="horizontal">
<input soneRadio id="demo-density-default" value="default" />
<label soneFieldLabel for="demo-density-default">Default</label>
</div>
<div soneField orientation="horizontal">
<input soneRadio id="demo-density-comfortable" value="comfortable" />
<label soneFieldLabel for="demo-density-comfortable">Comfortable</label>
</div>
<div soneField orientation="horizontal">
<input soneRadio id="demo-density-compact" value="compact" disabled />
<label soneFieldLabel for="demo-density-compact">Compact (soon)</label>
</div>
<p soneFieldDescription>Rows are {{ density() }}.</p>
</fieldset>インポート
import {
SoneRadioDirective,
SoneRadioGroupDirective,
} from "@surface-one/angular/radio-group";API リファレンス
SoneRadioDirectiveディレクティブ
`input[soneRadio]` — one native radio of a `[soneRadioGroup]`: it takes the group's `name`, is checked while its `value` is the group's, and checks it when picked. Pair it with a label through `[soneField] orientation="horizontal"` + `label[soneFieldLabel]`.
| 名前 | 型 | デフォルト |
|---|---|---|
value必須What the group's value becomes when this radio is checked. | string | — |
disabledDisables this radio alone. | boolean | false |
SoneRadioGroupDirectiveディレクティブ
`[soneRadioGroup]` — a set of native radios with one value (spartan/ui RadioGroup, native first): put it on a `fieldset` (with a `legend`) or a `div` (with an `aria-label`). It shares one `name` between its `input[soneRadio]`s, so the browser keeps the arrow keys and the single Tab stop, and holds the value — `[(value)]`, `ngModel` or `formControl`.
| 名前 | 型 | デフォルト |
|---|---|---|
value双方向The value of the checked radio, `null` while none is — `[(value)]`. | string | null | null |
nameThe `name` every radio of the group shares; unique by default. | string | soneId("sone-radio-group") |
disabledDisables every radio of the group. | boolean | false |
requiredOne of the radios must be checked (the native `required`). | boolean | false |
orientationLays the radios out in a column or a row. | RadioGroupOrientation | "vertical" |