Choice Card
カード全体が選択肢になるリッチなラジオカード。タブストップは 1 つで、矢印キーで移動できます。
対応フレームワーク
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 |