选择卡片用于需要一句话说明才能做出的决定:选哪个方案、由谁审核、用什么付款。每个选项都是一张选项卡片,即包裹原生单选按钮或复选框的 <label>,因此整张卡片都可点击,而状态、键盘操作和表单值仍由输入控件负责。无需脚本。
方案
<section class="sheet container-inline p-lg" aria-labelledby="cc-plan-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-plan-title"> Choose a plan for Atlas Labs </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 12rem"> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="hobby"> <span class="choice-body"> <span class="choice-title">Hobby</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">0</span><span class="price-period">per month</span> </span> <span class="choice-description">One project, previews for every branch.</span> </span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="pro" checked> <span class="choice-body"> <span class="choice-title">Pro</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">20</span><span class="price-period">per seat a month</span> </span> <span class="choice-description"> Unlimited projects, fourteen regions and 400 build minutes a seat. </span> </span> <span class="choice-end"><span class="badge badge-sm">Current</span></span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="enterprise"> <span class="choice-body"> <span class="choice-title">Enterprise</span> <span class="price price-sm"><span class="price-amount">Custom</span></span> <span class="choice-description"> From 5 seats, single sign-on, an audit log and a 99.99% uptime agreement. </span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <p class="m(0) fg-text-muted">Pro, 5 seats: $100 a month, billed on the 1st.</p> <button class="btn btn-primary btn-sm">Keep Pro</button> </div> </form></section><section className="sheet container-inline p-lg" aria-labelledby="cc-plan-title"> <form className="flex flex-col gap-md"> <fieldset className="fieldset gap-sm"> <legend className="fieldset-legend heading heading-sm" id="cc-plan-title"> Choose a plan for Atlas Labs </legend> <div className="auto-grid auto-grid-fit gap-sm" style={{ '--auto-grid-min': '12rem' } as React.CSSProperties}> <label className="choice"> <input type="radio" className="radio" name="cc-plan" value="hobby" /> <span className="choice-body"> <span className="choice-title">Hobby</span> <span className="price price-sm"> <span className="price-currency">$</span><span className="price-amount">0</span><span className="price-period">per month</span> </span> <span className="choice-description">One project, previews for every branch.</span> </span> </label> <label className="choice"> <input type="radio" className="radio" name="cc-plan" value="pro" defaultChecked /> <span className="choice-body"> <span className="choice-title">Pro</span> <span className="price price-sm"> <span className="price-currency">$</span><span className="price-amount">20</span><span className="price-period">per seat a month</span> </span> <span className="choice-description"> Unlimited projects, fourteen regions and 400 build minutes a seat. </span> </span> <span className="choice-end"><span className="badge badge-sm">Current</span></span> </label> <label className="choice"> <input type="radio" className="radio" name="cc-plan" value="enterprise" /> <span className="choice-body"> <span className="choice-title">Enterprise</span> <span className="price price-sm"><span className="price-amount">Custom</span></span> <span className="choice-description"> From 5 seats, single sign-on, an audit log and a 99.99% uptime agreement. </span> </span> </label> </div> </fieldset> <div className="flex flex-wrap items-center justify-between gap-sm"> <p className="m(0) fg-text-muted">Pro, 5 seats: $100 a month, billed on the 1st.</p> <button className="btn btn-primary btn-sm">Keep Pro</button> </div> </form></section><section class="sheet container-inline p-lg" aria-labelledby="cc-plan-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-plan-title"> Choose a plan for Atlas Labs </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 12rem"> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="hobby"> <span class="choice-body"> <span class="choice-title">Hobby</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">0</span><span class="price-period">per month</span> </span> <span class="choice-description">One project, previews for every branch.</span> </span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="pro" checked> <span class="choice-body"> <span class="choice-title">Pro</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">20</span><span class="price-period">per seat a month</span> </span> <span class="choice-description"> Unlimited projects, fourteen regions and 400 build minutes a seat. </span> </span> <span class="choice-end"><span class="badge badge-sm">Current</span></span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="enterprise"> <span class="choice-body"> <span class="choice-title">Enterprise</span> <span class="price price-sm"><span class="price-amount">Custom</span></span> <span class="choice-description"> From 5 seats, single sign-on, an audit log and a 99.99% uptime agreement. </span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <p class="m(0) fg-text-muted">Pro, 5 seats: $100 a month, billed on the 1st.</p> <button class="btn btn-primary btn-sm">Keep Pro</button> </div> </form></section><template> <section class="sheet container-inline p-lg" aria-labelledby="cc-plan-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-plan-title"> Choose a plan for Atlas Labs </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 12rem"> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="hobby"> <span class="choice-body"> <span class="choice-title">Hobby</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">0</span><span class="price-period">per month</span> </span> <span class="choice-description">One project, previews for every branch.</span> </span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="pro" checked> <span class="choice-body"> <span class="choice-title">Pro</span> <span class="price price-sm"> <span class="price-currency">$</span><span class="price-amount">20</span><span class="price-period">per seat a month</span> </span> <span class="choice-description"> Unlimited projects, fourteen regions and 400 build minutes a seat. </span> </span> <span class="choice-end"><span class="badge badge-sm">Current</span></span> </label> <label class="choice"> <input type="radio" class="radio" name="cc-plan" value="enterprise"> <span class="choice-body"> <span class="choice-title">Enterprise</span> <span class="price price-sm"><span class="price-amount">Custom</span></span> <span class="choice-description"> From 5 seats, single sign-on, an audit log and a 99.99% uptime agreement. </span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <p class="m(0) fg-text-muted">Pro, 5 seats: $100 a month, billed on the 1st.</p> <button class="btn btn-primary btn-sm">Keep Pro</button> </div> </form> </section></template>区块提供可直接复制的标记,沿用页面的文字颜色和字号。预览在 body 上设置 fg-text-body text-sm。每个区块都是尺寸容器,会根据自身宽度重排,无论放在宽页面、侧边栏大小的空间还是对话框中。
#区块组成
- 一个带
<legend>的<fieldset>。 legend 就是问题,并为这组单选按钮命名,因此每个选项都会被读作对这个问题的回答。它用heading heading-sm采用标题的字体样式。 - 每个选项都是一张选项卡片。 单选按钮位于卡片起始处;选中的卡片会浮起,轮廓改用前景色,无需依赖色相就能辨认选中状态,单选按钮本身的标记也表达同样的状态。
- 决定靠文字表达。 每张卡片有标题、有价格时显示价格,再用一句话说明该选项提供什么。当前生效的选项,即当前方案或默认付款方式,在第一行末尾用中性徽标标出。
- 卡片按区块宽度重排。
auto-grid auto-grid-fit配合--auto-grid-min,在宽空间中让各方案并排并分占整行,在窄空间中上下排列,无需编写断点。 - 摘要与所选项一致。 操作按钮前的一行说明所选方案按现有席位数计算的费用,操作按钮也写出该方案的名称。
#人员
可以选择多项时使用复选框,例如由谁审核、通知谁。每张卡片包含此人的头像、姓名和角色。卡片下方的一行说明选中了几人以及这意味着什么,并作为 fieldset 的描述。
人员
<section class="sheet container-inline p-lg" aria-labelledby="cc-people-title"> <fieldset class="fieldset gap-sm" aria-describedby="cc-people-count"> <legend class="fieldset-legend heading heading-sm" id="cc-people-title"> Who reviews deployments to production? </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 16rem"> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="yiching@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Yi-ching Lin</span> <span class="choice-description">Owner</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="misaki@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/misaki-sato.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Misaki Sato</span> <span class="choice-description">Admin</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="jihoon@atlaslabs.dev"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/jihoon-park.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Ji-hoon Park</span> <span class="choice-description">Member</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="kenta@atlaslabs.dev"> <span class="avatar avatar-sm" aria-hidden="true">KN</span> <span class="choice-body"> <span class="choice-title">Kenta Nakamura</span> <span class="choice-description">Member</span> </span> </label> </div> <p class="m(0) fg-text-muted" id="cc-people-count"> 2 of 4 people review. One approval is enough to deploy. </p> </fieldset></section><section className="sheet container-inline p-lg" aria-labelledby="cc-people-title"> <fieldset className="fieldset gap-sm" aria-describedby="cc-people-count"> <legend className="fieldset-legend heading heading-sm" id="cc-people-title"> Who reviews deployments to production? </legend> <div className="auto-grid auto-grid-fit gap-sm" style={{ '--auto-grid-min': '16rem' } as React.CSSProperties}> <label className="choice items-center"> <input type="checkbox" className="checkbox" name="cc-reviewers" value="yiching@atlaslabs.dev" defaultChecked /> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/people/yiching-lin.webp" alt="" width="256" height="256" /> </span> <span className="choice-body"> <span className="choice-title">Yi-ching Lin</span> <span className="choice-description">Owner</span> </span> </label> <label className="choice items-center"> <input type="checkbox" className="checkbox" name="cc-reviewers" value="misaki@atlaslabs.dev" defaultChecked /> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/people/misaki-sato.webp" alt="" width="256" height="256" /> </span> <span className="choice-body"> <span className="choice-title">Misaki Sato</span> <span className="choice-description">Admin</span> </span> </label> <label className="choice items-center"> <input type="checkbox" className="checkbox" name="cc-reviewers" value="jihoon@atlaslabs.dev" /> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/people/jihoon-park.webp" alt="" width="256" height="256" /> </span> <span className="choice-body"> <span className="choice-title">Ji-hoon Park</span> <span className="choice-description">Member</span> </span> </label> <label className="choice items-center"> <input type="checkbox" className="checkbox" name="cc-reviewers" value="kenta@atlaslabs.dev" /> <span className="avatar avatar-sm" aria-hidden="true">KN</span> <span className="choice-body"> <span className="choice-title">Kenta Nakamura</span> <span className="choice-description">Member</span> </span> </label> </div> <p className="m(0) fg-text-muted" id="cc-people-count"> 2 of 4 people review. One approval is enough to deploy. </p> </fieldset></section><section class="sheet container-inline p-lg" aria-labelledby="cc-people-title"> <fieldset class="fieldset gap-sm" aria-describedby="cc-people-count"> <legend class="fieldset-legend heading heading-sm" id="cc-people-title"> Who reviews deployments to production? </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 16rem"> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="yiching@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Yi-ching Lin</span> <span class="choice-description">Owner</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="misaki@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/misaki-sato.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Misaki Sato</span> <span class="choice-description">Admin</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="jihoon@atlaslabs.dev"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/jihoon-park.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Ji-hoon Park</span> <span class="choice-description">Member</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="kenta@atlaslabs.dev"> <span class="avatar avatar-sm" aria-hidden="true">KN</span> <span class="choice-body"> <span class="choice-title">Kenta Nakamura</span> <span class="choice-description">Member</span> </span> </label> </div> <p class="m(0) fg-text-muted" id="cc-people-count"> 2 of 4 people review. One approval is enough to deploy. </p> </fieldset></section><template> <section class="sheet container-inline p-lg" aria-labelledby="cc-people-title"> <fieldset class="fieldset gap-sm" aria-describedby="cc-people-count"> <legend class="fieldset-legend heading heading-sm" id="cc-people-title"> Who reviews deployments to production? </legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 16rem"> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="yiching@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Yi-ching Lin</span> <span class="choice-description">Owner</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="misaki@atlaslabs.dev" checked> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/misaki-sato.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Misaki Sato</span> <span class="choice-description">Admin</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="jihoon@atlaslabs.dev"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/jihoon-park.webp" alt width="256" height="256"> </span> <span class="choice-body"> <span class="choice-title">Ji-hoon Park</span> <span class="choice-description">Member</span> </span> </label> <label class="choice items-center"> <input type="checkbox" class="checkbox" name="cc-reviewers" value="kenta@atlaslabs.dev"> <span class="avatar avatar-sm" aria-hidden="true">KN</span> <span class="choice-body"> <span class="choice-title">Kenta Nakamura</span> <span class="choice-description">Member</span> </span> </label> </div> <p class="m(0) fg-text-muted" id="cc-people-count"> 2 of 4 people review. One approval is enough to deploy. </p> </fieldset> </section></template>#付款方式
从已保存的付款方式中选择一种。付款方式以读者认得出的信息命名,即品牌和末四位数字,并写出各自的差别:何时到期、需要多久、剩余多少额度。图标框中的图标只是装饰,标题才说明它是什么。
付款方式
<section class="sheet container-inline p-lg" aria-labelledby="cc-method-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-method-title"> Pay the invoice of November with </legend> <div class="flex flex-col gap-xs"> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="visa-ending-in-4821" checked> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="1.6667" y="3.3333" width="12.6667" height="9.3333" rx="1" /><path d="M1.6667 6.6667L14.3333 6.6667" /><path d="M4 10L6.6667 10" /> </svg> </span> <span class="choice-body"> <span class="choice-title">Visa ending in 4821</span> <span class="choice-description">Expires 08/2028</span> </span> <span class="choice-end"><span class="badge badge-sm">Default</span></span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="bank-account-ending-in-7310"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M2.6747 4.9585L7.9029 2.054A0.2 0.2 0 0 1 8.0971 2.054L13.3253 4.9585A0.2 0.2 0 0 1 13.2282 5.3333L2.7718 5.3333A0.2 0.2 0 0 1 2.6747 4.9585Z" /><path d="M4 7.3333L4 11.6667" /><path d="M8 7.3333L8 11.6667" /><path d="M12 7.3333L12 11.6667" /><path d="M2 14L14 14" /> </svg> </span> <span class="choice-body"> <span class="choice-title">Bank account ending in 7310</span> <span class="choice-description">Direct debit, 3 days to settle</span> </span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="atlas-credit"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <rect x="2" y="5.3333" width="12" height="2.6667" rx="0.8" /><path d="M3.3333 8L3.3333 13A1 1 0 0 0 4.3333 14L11.6667 14A1 1 0 0 0 12.6667 13L12.6667 8" /><path d="M8 5.3333L8 14" /><path d="M8 5.3333C5.3333 5.3333 3.6667 4.6667 3.6667 3C3.6667 0.6667 7.3333 1.6667 8 5.3333C8.6667 1.6667 12.3333 0.6667 12.3333 3C12.3333 4.6667 10.6667 5.3333 8 5.3333" /> </svg> </span> <span class="choice-body"> <span class="choice-title">Atlas credit</span> <span class="choice-description">$120.00 left, until 31 March</span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <a class="btn btn-quiet btn-sm" href="#cc-method-title"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M3 8L13 8" /><path d="M8 3L8 13" /> </svg>Add a payment method </a> <button class="btn btn-primary btn-sm">Pay $100.00</button> </div> </form></section>import CreditCardIcon from '@master/icons-react/native/16/soft/credit-card'import LandmarkIcon from '@master/icons-react/native/16/soft/landmark'import GiftIcon from '@master/icons-react/native/16/soft/gift'import PlusIcon from '@master/icons-react/native/16/soft/plus'<section className="sheet container-inline p-lg" aria-labelledby="cc-method-title"> <form className="flex flex-col gap-md"> <fieldset className="fieldset gap-sm"> <legend className="fieldset-legend heading heading-sm" id="cc-method-title"> Pay the invoice of November with </legend> <div className="flex flex-col gap-xs"> <label className="choice items-center"> <input type="radio" className="radio" name="cc-method" value="visa-ending-in-4821" defaultChecked /> <span className="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <CreditCardIcon className="icon" /> </span> <span className="choice-body"> <span className="choice-title">Visa ending in 4821</span> <span className="choice-description">Expires 08/2028</span> </span> <span className="choice-end"><span className="badge badge-sm">Default</span></span> </label> <label className="choice items-center"> <input type="radio" className="radio" name="cc-method" value="bank-account-ending-in-7310" /> <span className="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <LandmarkIcon className="icon" /> </span> <span className="choice-body"> <span className="choice-title">Bank account ending in 7310</span> <span className="choice-description">Direct debit, 3 days to settle</span> </span> </label> <label className="choice items-center"> <input type="radio" className="radio" name="cc-method" value="atlas-credit" /> <span className="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <GiftIcon className="icon" /> </span> <span className="choice-body"> <span className="choice-title">Atlas credit</span> <span className="choice-description">$120.00 left, until 31 March</span> </span> </label> </div> </fieldset> <div className="flex flex-wrap items-center justify-between gap-sm"> <a className="btn btn-quiet btn-sm" href="#cc-method-title"> <PlusIcon className="icon" />Add a payment method </a> <button className="btn btn-primary btn-sm">Pay $100.00</button> </div> </form></section><script> import CreditCardIcon from '@master/icons-svelte/native/16/soft/credit-card' import LandmarkIcon from '@master/icons-svelte/native/16/soft/landmark' import GiftIcon from '@master/icons-svelte/native/16/soft/gift' import PlusIcon from '@master/icons-svelte/native/16/soft/plus'</script><section class="sheet container-inline p-lg" aria-labelledby="cc-method-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-method-title"> Pay the invoice of November with </legend> <div class="flex flex-col gap-xs"> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="visa-ending-in-4821" checked> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <CreditCardIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Visa ending in 4821</span> <span class="choice-description">Expires 08/2028</span> </span> <span class="choice-end"><span class="badge badge-sm">Default</span></span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="bank-account-ending-in-7310"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <LandmarkIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Bank account ending in 7310</span> <span class="choice-description">Direct debit, 3 days to settle</span> </span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="atlas-credit"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <GiftIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Atlas credit</span> <span class="choice-description">$120.00 left, until 31 March</span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <a class="btn btn-quiet btn-sm" href="#cc-method-title"> <PlusIcon class="icon" />Add a payment method </a> <button class="btn btn-primary btn-sm">Pay $100.00</button> </div> </form></section><script setup>import CreditCardIcon from '@master/icons-vue/native/16/soft/credit-card'import LandmarkIcon from '@master/icons-vue/native/16/soft/landmark'import GiftIcon from '@master/icons-vue/native/16/soft/gift'import PlusIcon from '@master/icons-vue/native/16/soft/plus'</script><template> <section class="sheet container-inline p-lg" aria-labelledby="cc-method-title"> <form class="flex flex-col gap-md"> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend heading heading-sm" id="cc-method-title"> Pay the invoice of November with </legend> <div class="flex flex-col gap-xs"> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="visa-ending-in-4821" checked> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <CreditCardIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Visa ending in 4821</span> <span class="choice-description">Expires 08/2028</span> </span> <span class="choice-end"><span class="badge badge-sm">Default</span></span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="bank-account-ending-in-7310"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <LandmarkIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Bank account ending in 7310</span> <span class="choice-description">Direct debit, 3 days to settle</span> </span> </label> <label class="choice items-center"> <input type="radio" class="radio" name="cc-method" value="atlas-credit"> <span class="icon-frame icon-frame-xs icon-frame-raised" aria-hidden="true"> <GiftIcon class="icon" /> </span> <span class="choice-body"> <span class="choice-title">Atlas credit</span> <span class="choice-description">$120.00 left, until 31 March</span> </span> </label> </div> </fieldset> <div class="flex flex-wrap items-center justify-between gap-sm"> <a class="btn btn-quiet btn-sm" href="#cc-method-title"> <PlusIcon class="icon" />Add a payment method </a> <button class="btn btn-primary btn-sm">Pay $100.00</button> </div> </form> </section></template>该区块只在已保存的付款方式中选择,从不索取卡号:添加付款方式要用支付服务商自己的表单或页面,卡号由服务商保管,应用始终不经手。
#无障碍
- 每个区块都是一个通过 legend 的 id 命名的
<section>,legend 也为 fieldset 命名,作用于其中的每个选项。 - 每张卡片中的输入控件都是真正的单选按钮或复选框:方向键在单选按钮组内移动,空格键切换复选框,表单会提交其值。
- 整张卡片都是点击目标,在触摸屏上高度至少为 44px;焦点环绘制在卡片周围,而不是小小的输入控件上。
- 选中状态由输入控件本身的标记和卡片的前景色轮廓表示,从不只靠颜色。徽标用文字标明“当前”和“默认”。
- 姓名旁的头像只是装饰:其
alt留空,姓名缩写设置aria-hidden。
#相关内容
- 表面托盘、凸起面板与凹槽构成所有组件共用的材质层级。
- 标题沿用页面文本色的标题,可搭配上方的引题和下方的导语。
- 输入框嵌入表面的输入框,支持标签、提示、错误信息和输入框组。
- 选项卡片使用单选按钮或复选框的选项卡片,留有足够空间说明选项。
- 单选按钮用小圆形凹槽表示选项,供用户从多项中选择一项,基于原生单选按钮。
- 复选框小型原生凹槽,勾选后填充墨色。
- 价格按价格的阅读习惯排版,显示商品或服务的费用。
- 徽标用于显示状态、分类或计数的小型胶囊标签,只有颜色本身有含义时才使用彩色。
- 头像以照片或姓名首字母代表个人或团队,可单独显示或叠放。
- 图标框标题旁的小型凹面图标框,让图标保持原有尺寸。
- 按钮凸起的控件,悬停时抬升,按下时下沉。