Choice Card
整张卡片即为选项的富单选卡片,只占一个 Tab 停靠点,支持方向键导航。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
<div class="demo-stack" style="max-width: 36rem">
<div soneChoiceGroup aria-label="Plan"
style="display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-2)">
<button soneChoiceCard type="button" [selected]="plan() === 'free'" (click)="plan.set('free')">
<span soneChoiceCardTitle>Free</span>
<span soneChoiceCardDescription>Up to 3 projects.</span>
<span soneChoiceCardIndicator></span>
</button>
<button soneChoiceCard type="button" [selected]="plan() === 'team'" (click)="plan.set('team')">
<span soneChoiceCardTitle>Team</span>
<span soneChoiceCardDescription>Unlimited projects and shared spaces.</span>
<span soneChoiceCardIndicator></span>
</button>
<button soneChoiceCard type="button" disabled>
<span soneChoiceCardTitle>Enterprise</span>
<span soneChoiceCardDescription>Contact sales to enable.</span>
<span soneChoiceCardIndicator></span>
</button>
</div>
<button soneChoiceCard type="button" orientation="horizontal" [selected]="reminders()"
(click)="reminders.set(!reminders())">
<span style="display: grid; gap: var(--choice-card-gap)">
<span soneChoiceCardTitle>Email reminders</span>
<span soneChoiceCardDescription>A standalone card toggles on click.</span>
</span>
<span soneChoiceCardIndicator></span>
</button>
</div>导入
import {
SoneChoiceCardDescriptionDirective,
SoneChoiceCardDirective,
SoneChoiceCardIndicatorDirective,
SoneChoiceCardTitleDirective,
SoneChoiceGroupDirective,
} from "@surface-one/angular/choice-card";API 参考
SoneChoiceCardDescriptionDirective指令
SoneChoiceCardDirective指令
| 名称 | 类型 | 默认值 |
|---|---|---|
selected | boolean | false |
orientation | "vertical" | "horizontal" | "vertical" |
SoneChoiceCardIndicatorDirective指令
SoneChoiceCardTitleDirective指令
SoneChoiceGroupDirective指令
| 名称 | 类型 | 默认值 |
|---|---|---|
orientation | "vertical" | "horizontal" | null | null |