多步驟任務會依序詢問幾件事:進度指出讀者目前的位置,一次只處理手邊的一個步驟,步驟的操作則通往下一步或上一步。外框是頁面,因此整份文件一起捲動,操作按鈕則位於表單結尾,隨表單的內容流排列。範例分三個步驟設定工作區,並把輸入的內容保存在頁面自己的記憶體中。
多步驟任務
<div class="page bg-surface-base fg-text-body text-sm" data-example="multi-step"> <header class="navbar" style="--navbar-padding-x: max(1.5rem, calc(50% - 26rem))"> <a class="navbar-brand" href="#"> <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="8" cy="8" r="6" /> <path d="M8 4.3333A3.6667 3.6667 0 0 1 8 11.6667Z" fill="currentColor" stroke="none" /> </svg>Atlas</a> <a class="btn btn-quiet btn-sm ml-auto shrink(1)" href="#">Save and exit</a> </header> <main class="grow(1) w-full max-w(880) mx-auto px-lg pt-xl pb-2xl container-inline"> <header class="flex flex-col gap-3xs mb-xl"> <h1 class="heading heading-xl">Set up your workspace</h1> <p class="m(0) fg-text-muted">Three steps, about two minutes. Everything here can be changed later in settings.</p> </header> <nav class="mb-xl max-w(560) hidden@container(--3xl)" aria-label="Progress"> <ol class="steps" data-ms-progress="short"> <li class="steps-item basis-auto"> <a class="steps-title link link-quiet" href="#ms-details">Basic details</a> </li> <li class="steps-item basis-auto"> <a class="steps-title link link-quiet" href="#ms-preferences">Preferences</a> </li> <li class="steps-item basis-auto"> <span class="steps-title">Review</span> </li> </ol> </nav> <div class="flex gap-2xl items-start"> <nav class="w(224) shrink(0) sticky top(72) hidden block@container(--3xl)" aria-label="Progress"> <ol class="steps steps-vertical" data-ms-progress> <li class="steps-item"> <span class="steps-body"> <a class="steps-title link link-quiet" href="#ms-details">Basic details</a> <span class="steps-description">Name, address and contact</span> </span> </li> <li class="steps-item"> <span class="steps-body"> <a class="steps-title link link-quiet" href="#ms-preferences">Preferences</a> <span class="steps-description">Alerts and region</span> </span> </li> <li class="steps-item"> <span class="steps-body"> <span class="steps-title">Review</span> <span class="steps-description">Check, then create</span> </span> </li> </ol> </nav> <div class="grow(1) basis(0) min-w(0) max-w(560)"> <div data-ms-task> <form class="form" method="post"> <section id="ms-details" data-ms-step aria-labelledby="ms-details-title"> <div class="form-fields"> <div class="flex flex-col gap-3xs"> <h2 class="heading scroll-mt(72)" id="ms-details-title" tabindex="-1"> <span class="sr-only">Step 1 of 3:</span>Basic details</h2> <p class="m(0) fg-text-muted">What the workspace is called and who answers for it.</p> </div> <div class="field"> <label for="ms-name">Workspace name</label> <input class="input" id="ms-name" name="name" autocomplete="organization" required pattern=".*\S.*" data-error="ms-name-error"> <span class="field-error" id="ms-name-error">Enter a name for the workspace.</span> </div> <div class="field"> <label for="ms-slug">Address</label> <div class="input-group"> <span class="input-group-addon">atlas.dev/</span> <input class="input-group-field" id="ms-slug" name="slug" autocomplete="off" autocapitalize="none" spellcheck="false" pattern="[a-z0-9]+(-[a-z0-9]+)*" required aria-describedby="ms-slug-hint" data-error="ms-slug-error"> </div> <span class="field-hint" id="ms-slug-hint">Lowercase letters, numbers and hyphens.</span> <span class="field-error" id="ms-slug-error">Enter an address in lowercase letters, numbers and hyphens, such as atlas-labs.</span> </div> <div class="field"> <label for="ms-email">Contact email</label> <input class="input" id="ms-email" type="email" name="email" autocomplete="email" placeholder="you@company.com" required data-error="ms-email-error"> <span class="field-error" id="ms-email-error">Enter an email address, such as you@company.com.</span> </div> </div> </section> <section id="ms-preferences" data-ms-step aria-labelledby="ms-preferences-title"> <div class="form-fields"> <div class="flex flex-col gap-3xs"> <h2 class="heading scroll-mt(72)" id="ms-preferences-title" tabindex="-1"> <span class="sr-only">Step 2 of 3:</span>Preferences</h2> <p class="m(0) fg-text-muted">How Atlas reaches you, and where it builds.</p> </div> <fieldset class="fieldset gap-sm"> <legend class="fieldset-legend">Where should deployment alerts go?</legend> <div class="auto-grid auto-grid-fit gap-sm" style="--auto-grid-min: 11rem"> <label class="choice"> <input type="radio" class="radio" name="alerts" value="email" checked> <span class="choice-body"> <span class="choice-title">Email</span> <span class="choice-description">To the contact address, as each deployment fails.</span> </span> </label> <label class="choice"> <input type="radio" class="radio" name="alerts" value="phone"> <span class="choice-body"> <span class="choice-title">Phone</span> <span class="choice-description">A text message, for production only.</span> </span> </label> <label class="choice"> <input type="radio" class="radio" name="alerts" value="none"> <span class="choice-body"> <span class="choice-title">None</span> <span class="choice-description">Nothing is sent. Failures show in the dashboard.</span> </span> </label> </div> </fieldset> <div data-ms-phone> <div class="field"> <label for="ms-phone">Phone number</label> <input class="input" id="ms-phone" type="tel" name="phone" autocomplete="tel" pattern="\+?[0-9][0-9 \-]{6,}" aria-describedby="ms-phone-hint" data-error="ms-phone-error"> <span class="field-hint" id="ms-phone-hint">Needed only when alerts go to a phone. Include the country code.</span> <span class="field-error" id="ms-phone-error">Enter a phone number with its country code, such as +886 912 345 678.</span> </div> </div> <div class="field"> <label for="ms-region">Default region</label> <select class="select" id="ms-region" name="region" aria-describedby="ms-region-hint"> <option class="select-option" value="Tokyo (hnd1)">Tokyo (hnd1)</option> <option class="select-option" value="Singapore (sin1)">Singapore (sin1)</option> <option class="select-option" value="Frankfurt (fra1)">Frankfurt (fra1)</option> <option class="select-option" value="Washington, D.C. (iad1)">Washington, D.C. (iad1)</option> </select> <span class="field-hint" id="ms-region-hint">Where new projects are built and served.</span> </div> </div> </section> <section id="ms-review" data-ms-step data-ms-review aria-labelledby="ms-review-title" hidden> <div class="form-fields"> <div class="flex flex-col gap-3xs"> <h2 class="heading scroll-mt(72)" id="ms-review-title" tabindex="-1"> <span class="sr-only">Step 3 of 3:</span>Review</h2> <p class="m(0) fg-text-muted">Check what you entered, then create the workspace.</p> </div> <div class="flex flex-col gap-2xs"> <div class="flex items-center justify-between gap-sm"> <h3 class="heading heading-xs">Basic details</h3> <button type="button" class="btn btn-quiet btn-sm btn-hang-end" data-ms-edit="0">Edit <span class="sr-only">basic details</span> </button> </div> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term min-w(128)">Workspace name</dt> <dd class="data-list-value" data-ms-value="name"></dd> </div> <div class="data-list-item"> <dt class="data-list-term">Address</dt> <dd class="data-list-value" data-ms-value="address"></dd> </div> <div class="data-list-item"> <dt class="data-list-term">Contact email</dt> <dd class="data-list-value" data-ms-value="email"></dd> </div> </dl> </div> <div class="flex flex-col gap-2xs"> <div class="flex items-center justify-between gap-sm"> <h3 class="heading heading-xs">Preferences</h3> <button type="button" class="btn btn-quiet btn-sm btn-hang-end" data-ms-edit="1">Edit <span class="sr-only">preferences</span> </button> </div> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term min-w(128)">Deployment alerts</dt> <dd class="data-list-value" data-ms-value="alerts"></dd> </div> <div class="data-list-item"> <dt class="data-list-term">Default region</dt> <dd class="data-list-value" data-ms-value="region"></dd> </div> </dl> </div> </div> </section> <div class="form-actions"> <button type="button" class="btn hidden" data-ms-back>Back</button> <button class="btn btn-primary" data-ms-next>Create workspace</button> </div> </form> </div> <div data-ms-done hidden> <div class="flex flex-col items-start gap-md"> <span class="icon-frame icon-frame-success" aria-hidden="true"> <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M3.5 10L7.8545 14.3545A0.2 0.2 0 0 0 8.1413 14.3504L16.5 5.5" /> </svg> </span> <div class="flex flex-col gap-3xs"> <h2 class="heading scroll-mt(72)" tabindex="-1" data-ms-done-title>Workspace created</h2> <p class="m(0) fg-text-muted"> <span class="fg-text-strong" data-ms-value="name"></span>is ready at <span class="fg-text-strong" data-ms-value="address"></span>. This example keeps what you typed in memory only: nothing was sent.</p> </div> <button type="button" class="btn" data-ms-restart>Start over</button> </div> </div> </div> </div> </main></div>/** * A workspace set up in three steps, with nowhere to send it. The markup is one whole form in order, which is * what a browser without this module shows. The module divides it: it shows one step at a time, moves * aria-current along the progress, checks the step in hand before going on, and at the end swaps the form * for the result. What was typed stays in the fields, and where the reader is stays in `state`; nothing is * stored and nothing leaves the page. In a product each step is a route and the server keeps the draft. * Returns the function that stops it and puts the whole form back. */export function mount(root) { const controller = new AbortController() const { signal } = controller const task = root.querySelector('[data-ms-task]') const form = task.querySelector('.form') const steps = [...form.querySelectorAll('[data-ms-step]')] const review = form.querySelector('[data-ms-review]') const back = form.querySelector('[data-ms-back]') const next = form.querySelector('[data-ms-next]') const done = root.querySelector('[data-ms-done]') const phone = form.querySelector('[data-ms-phone]') // The same three steps twice: the vertical list of a wide page and the short row of a narrow one. const lists = [...root.querySelectorAll('[data-ms-progress]')].map(list => ({ list, short: list.dataset.msProgress === 'short', items: [...list.querySelectorAll('.steps-item')] })) const last = steps.length - 1 const submitLabel = next.textContent // Where the reader is, the furthest step they have reached, and whether the task is finished. const state = { step: 0, reached: 0, done: false } /** * A step's name in the progress is a link while the step can be opened and plain words while it cannot, as * the steps component asks: the element is replaced only when that changes. */ const name = (item, index, open) => { const old = item.querySelector('.steps-title') if ((old.localName === 'a') === open) return old const title = document.createElement(open ? 'a' : 'span') title.className = open ? 'steps-title link link-quiet' : 'steps-title' title.textContent = old.textContent if (open) title.href = `#${steps[index].id}` old.replaceWith(title) return title } const headingOf = (step) => steps[step].querySelector('.heading') const controlsOf = (step) => [...steps[step].querySelectorAll('input, select, textarea')].filter(control => control.willValidate) /** * A field's error is read with the field only while it shows: its id joins aria-describedby, after the hint, * while the field is marked or the browser reports it, and leaves when the value is valid again. */ const describe = (control) => { if (!control.dataset?.error) return const invalid = !control.validity.valid && (control.getAttribute('aria-invalid') === 'true' || control.matches(':user-invalid')) if (control.validity.valid) control.removeAttribute('aria-invalid') const ids = (control.getAttribute('aria-describedby') ?? '').split(' ').filter(id => id && id !== control.dataset.error) if (invalid) ids.push(control.dataset.error) if (ids.length) control.setAttribute('aria-describedby', ids.join(' ')) else control.removeAttribute('aria-describedby') } /** * The browser holds the rules (required, type, pattern) and shows a field's error once the reader has edited * it. A field never touched has to be marked here, with aria-invalid, when Next is pressed: a submit would mark * every field of the form as tried, the ones in steps not reached yet among them. Focus goes to the first. */ const check = (step) => { const invalid = controlsOf(step).filter(control => !control.validity.valid) for (const control of invalid) { control.setAttribute('aria-invalid', 'true') describe(control) } if (!invalid.length) return true if (state.step !== step) { state.step = step render() } invalid[0].focus() return false } // The phone number is asked for, and required, only while alerts go to a phone. const askPhone = () => { const field = phone.querySelector('.input') const wanted = form.elements.alerts.value === 'phone' phone.hidden = !wanted field.disabled = !wanted field.required = wanted if (!wanted) field.removeAttribute('aria-invalid') // An error that no longer shows is no longer read with the field when it comes back. describe(field) } const values = () => { const written = new FormData(form) const text = (name) => String(written.get(name) ?? '').trim() const alerts = { email: `Email to ${text('email')}`, phone: `Text message to ${text('phone')}`, none: 'None' } return { name: text('name'), address: `atlas.dev/${text('slug')}`, email: text('email'), alerts: alerts[text('alerts')], region: text('region') } } const render = () => { task.hidden = state.done done.hidden = !state.done steps.forEach((step, index) => { step.hidden = index !== state.step }) // A button's own display outranks the hidden attribute, so Back leaves with the utility of that name. back.classList.toggle('hidden', state.step === 0) next.textContent = state.step === last ? submitLabel : 'Next' for (const { list, short, items } of lists) { list.classList.toggle('steps-complete', state.done) items.forEach((item, index) => { const current = !state.done && index === state.step // A step already reached is a link back to it; the current one and the ones ahead are plain words. const open = !state.done && !current && index <= state.reached if (current) item.setAttribute('aria-current', 'step') else item.removeAttribute('aria-current') // In the short row the other steps' names are not drawn, and a link nobody can see is not one to tab to or // to tap: there a step already reached is words, and Back is the way to it. const title = name(item, index, open && !short) // The short row shows the current step's name; the others keep theirs for assistive technology. if (short) title.classList.toggle('sr-only', !current) }) } // What was typed is set as text, never as markup. if (state.done || state.step === last) { const written = values() for (const slot of root.querySelectorAll('[data-ms-value]')) slot.textContent = written[slot.dataset.msValue] } } /** * Going on checks every step passed on the way and stops at the first that fails. Going back checks nothing: * a reader may leave a step half written and find it as they left it. */ const go = (target) => { for (let step = state.step; step < target; step++) if (!check(step)) return state.step = target state.reached = Math.max(state.reached, target) render() headingOf(target).focus() } const advance = () => { if (state.step < last) return go(state.step + 1) for (let step = 0; step < last; step++) if (!check(step)) return state.done = true render() done.querySelector('[data-ms-done-title]').focus() } next.addEventListener('click', advance, { signal }) back.addEventListener('click', () => go(state.step - 1), { signal }) // Next is not a submit button, so Enter in a field is given the same meaning here. form.addEventListener('keydown', (event) => { if (event.key !== 'Enter' || event.isComposing || !event.target.matches('input')) return event.preventDefault() advance() }, { signal }) form.addEventListener('submit', event => event.preventDefault(), { signal }) for (const type of ['input', 'change', 'focusout']) { form.addEventListener(type, event => describe(event.target), { signal }) } form.addEventListener('change', (event) => { if (event.target.name === 'alerts') askPhone() }, { signal }) // A step already reached is opened from the progress, and from Edit in the review. for (const { list, items } of lists) { list.addEventListener('click', (event) => { const title = event.target.closest('a.steps-title') if (!title) return event.preventDefault() go(items.indexOf(title.closest('.steps-item'))) }, { signal }) } for (const edit of form.querySelectorAll('[data-ms-edit]')) { edit.addEventListener('click', () => go(Number(edit.dataset.msEdit)), { signal }) } const clear = () => { form.reset() for (const control of form.querySelectorAll('[data-error]')) { control.removeAttribute('aria-invalid') describe(control) } Object.assign(state, { step: 0, reached: 0, done: false }) } root.querySelector('[data-ms-restart]').addEventListener('click', () => { clear() askPhone() render() headingOf(0).focus() }, { signal }) next.type = 'button' askPhone() render() return () => { controller.abort() clear() // The whole form again, in order, as the markup has it. task.hidden = false done.hidden = true steps.forEach((step) => { step.hidden = step === review }) back.classList.add('hidden') next.type = 'submit' next.textContent = submitLabel phone.hidden = false phone.querySelector('.input').disabled = false phone.querySelector('.input').required = false for (const { list, items } of lists) { list.classList.remove('steps-complete') items.forEach((item, index) => { item.removeAttribute('aria-current') // The review holds no field, so the whole form has nothing to link its step to. name(item, index, steps[index] !== review).classList.remove('sr-only') }) } }}留下一個欄位不填就按「Next」,再填完這個步驟並繼續。按「Back」返回:先前輸入的內容仍然保留。在第二個步驟選擇「Phone」。在「平板」和「手機」寬度下,進度是表單上方的一列。
#建構方式
- 帶有任務頁首的頁面。 導覽列只放品牌和一個離開的出口,也就是用
ml-auto推到最遠端的低調按鈕「Save and exit」。任務沒有主導覽:其他每個連結都可能讓讀者失去手邊的工作。 - 任務共用同一個寬度。 主要區域是
max-w(880) mx-auto px-lg,同時是尺寸容器container-inline。扣除內距後剩下 832px:w(224)的進度欄、48px 的gap-2xl,以及max-w(560)的表單,這是單欄欄位仍易於閱讀的寬度。 - 以步驟呈現進度。 只有目前的項目帶有
aria-current="step";樣式表會把它之前的步驟繪製為已完成,之後的步驟繪製為等待中。可以開啟的步驟,其名稱是低調的連結,其他則是純文字。 - 整個任務只有一個表單。 每個步驟都是以其標題命名的
<section>,欄位放在form-fields中,因此維持表單 1.25rem 的間距。第二個步驟的選項採用選擇卡片區塊:以問題作為 legend 的<fieldset>,以及由選項組成的自動網格,在表單欄內每列三個,在手機上則上下排列。 form-actions位於表單結尾。 在原始碼中,Back 排在最前面,確認按鈕排在最後。表單窄於 24rem 時,兩者會以全寬上下堆疊,確認按鈕在上,手機就是這種情況。沒有任何東西固定在檢視區底部:一旦開啟螢幕鍵盤,固定在那裡的列就會蓋住上方的欄位。- 檢閱畫面為每個步驟提供一份資料清單,位於步驟名稱和用來開啟該步驟的 Edit 按鈕下方。這個按鈕是低調按鈕並套用
btn-hang-end,因此文字的結尾會貼齊各個值延伸到的邊緣。
#各寬度下的進度
頁面中有兩份進度,但只顯示其中一份。
- 主要區域達到 48rem 時,進度是表單旁的
steps steps-vertical清單:每個步驟都有名稱,以及一行說明該步驟要填寫的內容。清單設為sticky top(72),位於 56px 的導覽列下方 16px 處,因此捲動較長的步驟時仍留在可見範圍內。 - 小於 48rem 時,進度是表單上方的一列
steps。這一列只顯示目前步驟的名稱;另外兩個步驟的名稱為sr-only,因此位置由標記和連接線表達,每個名稱也仍會被朗讀。
橫列套用 hidden@container(--3xl),直欄套用 hidden block@container(--3xl)。未顯示的那一份是 display: none,因此輔助技術和鍵盤只會遇到一份進度。
三個名稱都顯示的一列步驟放不進手機:元件會以省略符號截斷放不下的名稱。只顯示一個名稱時,這一列在 390px 寬度下可以完整呈現。這一列的每個項目都是 basis-auto,因此目前的步驟占用其名稱所需的空間,另外兩個平分其餘空間。在文字放大為兩倍的手機上,連這一個名稱也會被截斷;橫列下方的標題則會完整寫出。
#由腳本決定的部分
標記是依序排列的完整表單:兩個步驟的欄位,接著是一個送出表單的按鈕。把表單分成步驟的是範例的模組,而它之所以簡短,是因為大部分的工作由瀏覽器和樣式表完成。
- 規則由瀏覽器掌管。
required、type="email"和pattern定義了什麼是有效的值,模組只讀取validity.valid。每個欄位的訊息都放在field-error中,輸入欄位的樣式表會在欄位無效時顯示它,恢復有效後再隱藏。 - 讀者編輯過欄位之後,
:user-invalid才顯示錯誤。 這不需要腳本。從未碰過的欄位則是另一回事:按下 Next 時,模組會在該步驟中每個未通過的欄位上設定aria-invalid="true",繪製出相同的狀態,並在各個值變為有效時移除。 - Next 是一般按鈕,不是送出按鈕。 嘗試送出會把表單中的每個欄位都標記為已嘗試,包括尚未到達的步驟中的欄位,這些欄位一開啟就會顯示錯誤。因此模組自行檢查手邊的步驟,並讓欄位中的 Enter 與 Next 具有相同的作用。
- 焦點跟著讀者移動。 步驟未通過時,焦點會移到其中第一個無效的欄位。切換步驟時,焦點會移到新步驟的標題,標題會說出步驟的名稱和位置,例如「Step 2 of 3: Preferences」。
- 返回時不做任何檢查。 Back、進度中的步驟名稱和檢閱畫面中的 Edit,都會讓目前的步驟保持原樣,即使只填了一半;每個欄位也都保有它的值,因為欄位從未離開文件。前進時會沿途檢查每個步驟,並停在第一個未通過的步驟。尚未到達的步驟不是連結,因此無法直接跳過去。
- 取決於答案的欄位。 只有在警示要傳送到手機時,電話號碼欄位才會顯示,並設為必填。不顯示時它是
disabled,因此既不會被檢查,也不會被送出。
在實際產品中,這些工作大多屬於路由器和伺服器:
- 每個步驟各有一個路由,例如
/setup/details和/setup/preferences。如此一來,每個步驟都是獨立的表單,Next 是它的送出按鈕,瀏覽器的上一頁和重新載入也會符合讀者的預期。進度中的連結則是通往這些路由的真正連結。 - 伺服器會再次驗證每個步驟,並回傳它找到的錯誤。請以相同的方式顯示:在欄位上設定
aria-invalid="true",並把訊息放進它的field-error。 - 草稿由伺服器保存。 每次按下 Next 都會儲存該步驟的內容,「Save and exit」會儲存後離開,檢閱畫面則改為讀回草稿,而不是讀取欄位。已到達的最遠步驟是草稿的一部分,伺服器會拒絕超出該步驟的路由。
#使用時機
順序重要時才使用步驟:後面的步驟取決於前面的答案,或是全部內容一次呈現會讓人難以消化。三到五個步驟是合適的範圍;如果更多,請想想其中某些步驟能否等到任務完成之後再處理。
- 各組設定彼此獨立,而且讀者會回來修改其中一組時,請使用設定頁面。它的導覽讓讀者能以任意順序開啟任何一組。
- 所有內容放得進一個畫面時,請使用單一表單。分成步驟會讓讀者失去全貌,每個部分還要多按一次。
- 前後都沒有其他步驟的單一簡短任務(例如登入),請使用置中版面。
#無障礙
- 地標包括頁首、主要區域,以及一個名為「Progress」的導覽。手邊的步驟是以其標題命名的
<section>。 - 進度是
<ol>,因此清單會說出步驟的數量,目前的步驟則帶有aria-current="step"。在精簡的橫列中,未顯示的名稱仍在清單裡。 - 切換步驟後,焦點會落在步驟的標題上;標題設有
tabindex="-1"和scroll-mt(72),因此不會被黏附的導覽列蓋住。螢幕閱讀器會從這裡讀出步驟的位置和名稱,按 Tab 則會移到第一個欄位。 - 步驟未通過時,焦點會落在第一個無效的欄位上。欄位的
field-error顯示期間,會加入該欄位的aria-describedby,因此訊息會與標籤一起讀出。 - 完成時,焦點會移到結果的標題;「Start over」會清除欄位,並回到第一個步驟的標題。
- 沒有腳本時,頁面是一個長表單:兩個步驟的欄位都在標記中,沒有任何一個是
hidden;電話號碼欄位會說明何時需要填寫,按鈕則會一次送出所有內容。只有不含欄位的 Back、檢閱畫面和結果,一開始是隱藏的。
#相關項目
- 步驟以編號清單顯示讀者目前在簡短流程中的哪一步,例如結帳或設定流程。
- 表單讓列、區段和操作按鈕隨欄寬調整,維持一致的表單版面配置。
- 輸入欄位採內凹樣式的文字欄位,支援標籤、提示、錯誤訊息與群組。
- 選項有足夠空間說明內容的單選或核取方塊選項。
- 單選按鈕可從多個選項中選出一項的小圓形控制項,直接使用原生單選按鈕。
- 下拉選單原生下拉選單,選項清單採用與介面一致的樣式。
- 自動網格在可用空間內排入最多等寬欄,由網格自行計算欄數。
- 資料清單用欄位名稱與值呈現單一項目的資料,以細線分隔,例如一次部署、一筆訂單或一份個人資料。
- 導覽列位於頁面頂端的導覽列,頁面內容捲到它下方時才會顯示背景。
- 按鈕凸起的控制項,懸停時微微抬升,按下時向內凹陷。
- 連結沿用句子的文字顏色,帶使用者前往其他位置。
- 標題以頁面的高對比文字色呈現標題,搭配上方的前導標籤與下方的引言。
- 圖示框在標題旁以指定大小呈現圖示的裝飾框。