Radio Group

一组共享名称和取值的原生单选按钮,支持方向键和单一 Tab 停靠点,可用作表单控件。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

Density

Rows are comfortable.

导入

ts
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]`.

选择器
input[soneRadio]
导出为
soneRadio
输入
名称类型 默认值
value必填

What the group's value becomes when this radio is checked.

string—
disabled

Disables this radio alone.

booleanfalse

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`.

选择器
[soneRadioGroup]
导出为
soneRadioGroup
输入
名称类型 默认值
value双向

The value of the checked radio, `null` while none is — `[(value)]`.

string | nullnull
name

The `name` every radio of the group shares; unique by default.

stringsoneId("sone-radio-group")
disabled

Disables every radio of the group.

booleanfalse
required

One of the radios must be checked (the native `required`).

booleanfalse
orientation

Lays the radios out in a column or a row.

RadioGroupOrientation"vertical"