輸入欄位
採內凹樣式的文字欄位,支援標籤、提示、錯誤訊息與群組。
本頁內容
文字欄位預設呈內凹效果,外緣有半像素的輪廓線。取得焦點時,欄位會與面板齊平,並顯示一道前景色輪廓線與柔和的光暈。將 .input 加在 <input> 和 <textarea> 上,並將 .field 加在包住欄位的 <label> 上。
輸入欄位
<label class="field"> Email <input class="input" type="email" autocomplete="email" placeholder="you@example.com"></label><label className="field"> Email <input className="input" type="email" autoComplete="email" placeholder="you@example.com" /></label><label class="field"> Email <input class="input" type="email" autocomplete="email" placeholder="you@example.com"></label><template> <label class="field"> Email <input class="input" type="email" autocomplete="email" placeholder="you@example.com"> </label></template>#提示與錯誤
用 aria-describedby 將提示或錯誤訊息連結到欄位,並用 aria-invalid="true" 標記無效值。field-error 只在欄位無效時顯示,並在顯示期間取代提示,因此兩者一開始就可以寫進標記。
提示與錯誤
<div class="field"> <label for="project-name">Project name</label> <input class="input" id="project-name" value="atlas" aria-describedby="name-hint"> <span class="field-hint" id="name-hint">Lowercase letters, numbers and dashes.</span></div><div class="field"> <label for="project-domain">Domain</label> <input class="input" id="project-domain" value="atlas" aria-invalid="true" aria-describedby="domain-error"> <span class="field-error" id="domain-error">Enter a full domain, such as atlas.dev.</span></div><> <div className="field"> <label htmlFor="project-name">Project name</label> <input className="input" id="project-name" defaultValue="atlas" aria-describedby="name-hint" /> <span className="field-hint" id="name-hint">Lowercase letters, numbers and dashes.</span> </div> <div className="field"> <label htmlFor="project-domain">Domain</label> <input className="input" id="project-domain" defaultValue="atlas" aria-invalid="true" aria-describedby="domain-error" /> <span className="field-error" id="domain-error">Enter a full domain, such as atlas.dev.</span> </div></><div class="field"> <label for="project-name">Project name</label> <input class="input" id="project-name" value="atlas" aria-describedby="name-hint"> <span class="field-hint" id="name-hint">Lowercase letters, numbers and dashes.</span></div><div class="field"> <label for="project-domain">Domain</label> <input class="input" id="project-domain" value="atlas" aria-invalid="true" aria-describedby="domain-error"> <span class="field-error" id="domain-error">Enter a full domain, such as atlas.dev.</span></div><template> <div class="field"> <label for="project-name">Project name</label> <input class="input" id="project-name" value="atlas" aria-describedby="name-hint"> <span class="field-hint" id="name-hint">Lowercase letters, numbers and dashes.</span> </div> <div class="field"> <label for="project-domain">Domain</label> <input class="input" id="project-domain" value="atlas" aria-invalid="true" aria-describedby="domain-error"> <span class="field-error" id="domain-error">Enter a full domain, such as atlas.dev.</span> </div></template>#原生驗證
瀏覽器的原生驗證條件也能觸發相同狀態,無須腳本。設有 required、type 或 pattern 的欄位若不符合驗證條件,會透過 :user-invalid 顯示錯誤輪廓。這個選擇器只在使用者編輯過欄位或嘗試送出表單後才會符合,剛開啟表單時不會生效。field-error 也會一併顯示。
原生驗證
<form class="flex flex-col gap-md"> <div class="field"> <label for="work-email">Work email</label> <input class="input" id="work-email" type="email" autocomplete="work email" required placeholder="you@company.com" aria-describedby="work-email-hint work-email-error"> <span class="field-hint" id="work-email-hint"> Type something that is not an email, then leave the field. </span> <span class="field-error" id="work-email-error"> Enter an email address, such as ada@example.com. </span> </div> <button type="submit" class="btn btn-primary self-start">Continue</button></form><form className="flex flex-col gap-md"> <div className="field"> <label htmlFor="work-email">Work email</label> <input className="input" id="work-email" type="email" autoComplete="work email" required placeholder="you@company.com" aria-describedby="work-email-hint work-email-error" /> <span className="field-hint" id="work-email-hint"> Type something that is not an email, then leave the field. </span> <span className="field-error" id="work-email-error"> Enter an email address, such as ada@example.com. </span> </div> <button type="submit" className="btn btn-primary self-start">Continue</button></form><form class="flex flex-col gap-md"> <div class="field"> <label for="work-email">Work email</label> <input class="input" id="work-email" type="email" autocomplete="work email" required placeholder="you@company.com" aria-describedby="work-email-hint work-email-error"> <span class="field-hint" id="work-email-hint"> Type something that is not an email, then leave the field. </span> <span class="field-error" id="work-email-error"> Enter an email address, such as ada@example.com. </span> </div> <button type="submit" class="btn btn-primary self-start">Continue</button></form><template> <form class="flex flex-col gap-md"> <div class="field"> <label for="work-email">Work email</label> <input class="input" id="work-email" type="email" autocomplete="work email" required placeholder="you@company.com" aria-describedby="work-email-hint work-email-error"> <span class="field-hint" id="work-email-hint"> Type something that is not an email, then leave the field. </span> <span class="field-error" id="work-email-error"> Enter an email address, such as ada@example.com. </span> </div> <button type="submit" class="btn btn-primary self-start">Continue</button> </form></template>#尺寸
欄位有 32、38 和 44px 三種高度,與按鈕、下拉選單和分段控制項一致,因此不論使用滑鼠或手指,同列擺放時都能齊平:在觸控螢幕上,欄位維持原本的高度與字級,由頁面的檢視區設定避免 iOS 在欄位取得焦點時放大頁面。
尺寸
<input class="input input-sm" placeholder="Small" aria-label="Small"><input class="input" placeholder="Medium" aria-label="Medium"><input class="input input-lg" placeholder="Large" aria-label="Large"><> <input className="input input-sm" placeholder="Small" aria-label="Small" /> <input className="input" placeholder="Medium" aria-label="Medium" /> <input className="input input-lg" placeholder="Large" aria-label="Large" /></><input class="input input-sm" placeholder="Small" aria-label="Small"><input class="input" placeholder="Medium" aria-label="Medium"><input class="input input-lg" placeholder="Large" aria-label="Large"><template> <input class="input input-sm" placeholder="Small" aria-label="Small"> <input class="input" placeholder="Medium" aria-label="Medium"> <input class="input input-lg" placeholder="Large" aria-label="Large"></template>#多行文字欄位
套用 .input 的 <textarea> 會保留你指定的列數,並提供垂直調整大小的把手。加上 input-auto 即可讓欄位隨內容增高。field-sizing: content 會將高度控制在三到十二行,超過後即可捲動。可用 --input-rows 和 --input-max-rows 調整範圍。瀏覽器若不支援 field-sizing,欄位會保留最小高度和調整把手。
多行文字欄位
<label class="field"> Message <textarea class="input" rows="3" placeholder="A fixed height with a resize handle"></textarea></label><label class="field"> Notes <textarea class="input input-auto" placeholder="Keep typing: this one grows with its content"></textarea></label><> <label className="field"> Message <textarea className="input" rows={3} placeholder="A fixed height with a resize handle">{``}</textarea> </label> <label className="field"> Notes <textarea className="input input-auto" placeholder="Keep typing: this one grows with its content">{``}</textarea> </label></><label class="field"> Message <textarea class="input" rows="3" placeholder="A fixed height with a resize handle"></textarea></label><label class="field"> Notes <textarea class="input input-auto" placeholder="Keep typing: this one grows with its content"></textarea></label><template> <label class="field"> Message <textarea class="input" rows="3" placeholder="A fixed height with a resize handle"></textarea> </label> <label class="field"> Notes <textarea class="input input-auto" placeholder="Keep typing: this one grows with its content"></textarea> </label></template>#輸入群組
input-group 用同一個凹槽包住未套外框的欄位及其附屬內容,例如圖示、單位、快捷鍵或按鈕。群組透過 :has() 呈現內部欄位的懸停、焦點、無效和停用狀態,套用 input-group-field 的欄位本身則保留輸入語意與文字游標。將群組設為 <label>,點擊凹槽任一處即可讓欄位取得焦點。
輸入群組
<label class="input-group"> <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="7" cy="7" r="4.5" /><path d="M10.182 10.182L14 14" /> </svg> <input class="input-group-field" type="search" placeholder="Search projects" aria-label="Search projects"> <kbd class="kbd">⌘K</kbd></label><label class="input-group"> <span class="input-group-addon">https://</span> <input class="input-group-field" value="atlas" aria-label="Subdomain"> <span class="input-group-addon">.master.co</span></label><label class="input-group"> <input class="input-group-field" type="number" value="24" aria-label="Timeout"> <span class="input-group-addon">seconds</span></label>import SearchIcon from '@master/icons-react/native/16/soft/search'<> <label className="input-group"> <SearchIcon className="icon" /> <input className="input-group-field" type="search" placeholder="Search projects" aria-label="Search projects" /> <kbd className="kbd">⌘K</kbd> </label> <label className="input-group"> <span className="input-group-addon">https://</span> <input className="input-group-field" defaultValue="atlas" aria-label="Subdomain" /> <span className="input-group-addon">.master.co</span> </label> <label className="input-group"> <input className="input-group-field" type="number" defaultValue="24" aria-label="Timeout" /> <span className="input-group-addon">seconds</span> </label></><script> import SearchIcon from '@master/icons-svelte/native/16/soft/search'</script><label class="input-group"> <SearchIcon class="icon" /> <input class="input-group-field" type="search" placeholder="Search projects" aria-label="Search projects"> <kbd class="kbd">⌘K</kbd></label><label class="input-group"> <span class="input-group-addon">https://</span> <input class="input-group-field" value="atlas" aria-label="Subdomain"> <span class="input-group-addon">.master.co</span></label><label class="input-group"> <input class="input-group-field" type="number" value="24" aria-label="Timeout"> <span class="input-group-addon">seconds</span></label><script setup>import SearchIcon from '@master/icons-vue/native/16/soft/search'</script><template> <label class="input-group"> <SearchIcon class="icon" /> <input class="input-group-field" type="search" placeholder="Search projects" aria-label="Search projects"> <kbd class="kbd">⌘K</kbd> </label> <label class="input-group"> <span class="input-group-addon">https://</span> <input class="input-group-field" value="atlas" aria-label="Subdomain"> <span class="input-group-addon">.master.co</span> </label> <label class="input-group"> <input class="input-group-field" type="number" value="24" aria-label="Timeout"> <span class="input-group-addon">seconds</span> </label></template>群組內的按鈕距離凹槽邊緣 4px,圓角半徑比凹槽小 4px,因此各種尺寸下的內外圓角都維持同心。群組內有按鈕時,請用 <div> 作為群組容器。
搭配按鈕
<form class="input-group"> <input class="input-group-field" type="email" autocomplete="email" placeholder="you@example.com" aria-label="Email"> <button type="submit" class="btn btn-primary">Subscribe</button></form><div class="input-group input-group-sm"> <input class="input-group-field" value="https://atlas.dev/p/9f2c" readonly aria-label="Share link"> <button type="button" class="btn">Copy</button></div><> <form className="input-group"> <input className="input-group-field" type="email" autoComplete="email" placeholder="you@example.com" aria-label="Email" /> <button type="submit" className="btn btn-primary">Subscribe</button> </form> <div className="input-group input-group-sm"> <input className="input-group-field" defaultValue="https://atlas.dev/p/9f2c" readOnly aria-label="Share link" /> <button type="button" className="btn">Copy</button> </div></><form class="input-group"> <input class="input-group-field" type="email" autocomplete="email" placeholder="you@example.com" aria-label="Email"> <button type="submit" class="btn btn-primary">Subscribe</button></form><div class="input-group input-group-sm"> <input class="input-group-field" value="https://atlas.dev/p/9f2c" readonly aria-label="Share link"> <button type="button" class="btn">Copy</button></div><template> <form class="input-group"> <input class="input-group-field" type="email" autocomplete="email" placeholder="you@example.com" aria-label="Email"> <button type="submit" class="btn btn-primary">Subscribe</button> </form> <div class="input-group input-group-sm"> <input class="input-group-field" value="https://atlas.dev/p/9f2c" readonly aria-label="Share link"> <button type="button" class="btn">Copy</button> </div></template>若要讓欄位和按鈕各自獨立,請用 flex 並排,例如 <form class="flex gap-xs">。
#多值輸入
input-group-wrap 讓群組可以收集多個值,例如收件者、標籤或篩選條件。每個值都在群組內顯示為一個膠囊標籤,輸入欄位占用最後一列的剩餘空間,值放不下時群組就會增加一列。膠囊標籤距離群組邊緣 6px,內外圓角維持同心。
樣式表負責排列這些值。標籤輸入會在按下 Enter 時新增值;在空白欄位按 Backspace 會先移到最後一個值,再按一次才會移除它;多值組合方塊則從清單中選取這些值。
多值輸入
<div class="field max-w(420) mx-auto"> <label for="input-teams">Teams</label> <div class="input-group input-group-wrap"> <span class="chip"> Design<button type="button" class="chip-remove" aria-label="Remove Design"> <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="M4 4L12 12" /><path d="M4 12L12 4" /> </svg> </button> </span> <span class="chip"> Research<button type="button" class="chip-remove" aria-label="Remove Research"> <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="M4 4L12 12" /><path d="M4 12L12 4" /> </svg> </button> </span> <span class="chip"> Engineering<button type="button" class="chip-remove" aria-label="Remove Engineering"> <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="M4 4L12 12" /><path d="M4 12L12 4" /> </svg> </button> </span> <span class="chip"> Operations<button type="button" class="chip-remove" aria-label="Remove Operations"> <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="M4 4L12 12" /><path d="M4 12L12 4" /> </svg> </button> </span> <input class="input-group-field" id="input-teams" placeholder="Add a team"> </div></div>import XIcon from '@master/icons-react/native/16/soft/x'<div className="field max-w(420) mx-auto"> <label htmlFor="input-teams">Teams</label> <div className="input-group input-group-wrap"> <span className="chip"> Design<button type="button" className="chip-remove" aria-label="Remove Design"> <XIcon className="icon" /> </button> </span> <span className="chip"> Research<button type="button" className="chip-remove" aria-label="Remove Research"> <XIcon className="icon" /> </button> </span> <span className="chip"> Engineering<button type="button" className="chip-remove" aria-label="Remove Engineering"> <XIcon className="icon" /> </button> </span> <span className="chip"> Operations<button type="button" className="chip-remove" aria-label="Remove Operations"> <XIcon className="icon" /> </button> </span> <input className="input-group-field" id="input-teams" placeholder="Add a team" /> </div></div><script> import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div class="field max-w(420) mx-auto"> <label for="input-teams">Teams</label> <div class="input-group input-group-wrap"> <span class="chip"> Design<button type="button" class="chip-remove" aria-label="Remove Design"> <XIcon class="icon" /> </button> </span> <span class="chip"> Research<button type="button" class="chip-remove" aria-label="Remove Research"> <XIcon class="icon" /> </button> </span> <span class="chip"> Engineering<button type="button" class="chip-remove" aria-label="Remove Engineering"> <XIcon class="icon" /> </button> </span> <span class="chip"> Operations<button type="button" class="chip-remove" aria-label="Remove Operations"> <XIcon class="icon" /> </button> </span> <input class="input-group-field" id="input-teams" placeholder="Add a team"> </div></div><script setup>import XIcon from '@master/icons-vue/native/16/soft/x'</script><template> <div class="field max-w(420) mx-auto"> <label for="input-teams">Teams</label> <div class="input-group input-group-wrap"> <span class="chip"> Design<button type="button" class="chip-remove" aria-label="Remove Design"> <XIcon class="icon" /> </button> </span> <span class="chip"> Research<button type="button" class="chip-remove" aria-label="Remove Research"> <XIcon class="icon" /> </button> </span> <span class="chip"> Engineering<button type="button" class="chip-remove" aria-label="Remove Engineering"> <XIcon class="icon" /> </button> </span> <span class="chip"> Operations<button type="button" class="chip-remove" aria-label="Remove Operations"> <XIcon class="icon" /> </button> </span> <input class="input-group-field" id="input-teams" placeholder="Add a team"> </div> </div></template>#搜尋與自動填入
type="search" 欄位保留瀏覽器的清除按鈕,並將它重繪為圖示前景色的細叉。瀏覽器自動填入欄位時,凹槽會染上一層淡淡的資訊色,取代瀏覽器引擎原本的黃色或藍色,讓填好的表單維持一致的外觀。
搜尋
<input class="input max-w(360) mx-auto" type="search" value="moonstone" aria-label="Search"><input className="input max-w(360) mx-auto" type="search" defaultValue="moonstone" aria-label="Search" /><input class="input max-w(360) mx-auto" type="search" value="moonstone" aria-label="Search"><template> <input class="input max-w(360) mx-auto" type="search" value="moonstone" aria-label="Search"></template>#檔案
<input type="file"> 的瀏覽器按鈕會變成一個小型凸起控制項,嵌在凹槽中,就像分段控制項軌道上的選項。
檔案
<label class="field">Attachment <input class="input" type="file"></label><label className="field">Attachment <input className="input" type="file" /></label><label class="field">Attachment <input class="input" type="file"></label><template> <label class="field">Attachment <input class="input" type="file"></label></template>#日期、時間、數字與色彩
.input 為瀏覽器原生的日期、時間、數字與色彩欄位套用相同的凹槽樣式。選擇器沿用平台原生介面,使用者在自己的裝置上看到的是熟悉的操作方式。色彩欄位呈方形,色票從邊緣向內縮 4px,圓角與外框維持同心。
瀏覽器在這些欄位加上的小符號,會以與圖示一致的線條粗細和前景色重繪。日曆或時鐘圖示可開啟選擇器,數字欄位則有一對尖角圖示,上方朝上,用來增加數值,下方朝下,用來減少數值。Chromium 和 Safari 開放這些部位供樣式表調整,Firefox 則保留原生樣式。若使用者經常需要逐步調整數值,請用數字步進器。
日期、時間、數字與色彩
<label class="field">Starts <input class="input" type="date" value="2026-11-11"></label><label class="field">At <input class="input" type="time" value="09:30"></label><label class="field"> Timeout in seconds <input class="input" type="number" min="0" step="5" value="30"></label><label class="field">Accent <input class="input" type="color" value="#5b4fe0"></label><> <label className="field"> Starts <input className="input" type="date" defaultValue="2026-11-11" /> </label> <label className="field">At <input className="input" type="time" defaultValue="09:30" /></label> <label className="field"> Timeout in seconds <input className="input" type="number" min="0" step="5" defaultValue="30" /> </label> <label className="field"> Accent <input className="input" type="color" defaultValue="#5b4fe0" /> </label></><label class="field">Starts <input class="input" type="date" value="2026-11-11"></label><label class="field">At <input class="input" type="time" value="09:30"></label><label class="field"> Timeout in seconds <input class="input" type="number" min="0" step="5" value="30"></label><label class="field">Accent <input class="input" type="color" value="#5b4fe0"></label><template> <label class="field">Starts <input class="input" type="date" value="2026-11-11"></label> <label class="field">At <input class="input" type="time" value="09:30"></label> <label class="field"> Timeout in seconds <input class="input" type="number" min="0" step="5" value="30"> </label> <label class="field">Accent <input class="input" type="color" value="#5b4fe0"></label></template>#欄位集
在 <fieldset> 上加上 fieldset,可將相關控制項歸在同一個標題下,並移除瀏覽器預設的凹槽邊框。fieldset-legend 則讓 <legend> 採用欄位標籤的樣式。用欄位集包住核取方塊、單選按鈕或選項,即可為整組控制項命名。
欄位集
<fieldset class="fieldset"> <legend class="fieldset-legend">Notify me about</legend> <label class="check"><input type="checkbox" class="checkbox" checked> Failed deployments</label> <label class="check"> <input type="checkbox" class="checkbox" checked> Expiring certificates </label> <label class="check"><input type="checkbox" class="checkbox"> Product news</label></fieldset><fieldset className="fieldset"> <legend className="fieldset-legend">Notify me about</legend> <label className="check"> <input type="checkbox" className="checkbox" defaultChecked /> Failed deployments </label> <label className="check"> <input type="checkbox" className="checkbox" defaultChecked /> Expiring certificates </label> <label className="check"><input type="checkbox" className="checkbox" /> Product news</label></fieldset><fieldset class="fieldset"> <legend class="fieldset-legend">Notify me about</legend> <label class="check"><input type="checkbox" class="checkbox" checked> Failed deployments</label> <label class="check"> <input type="checkbox" class="checkbox" checked> Expiring certificates </label> <label class="check"><input type="checkbox" class="checkbox"> Product news</label></fieldset><template> <fieldset class="fieldset"> <legend class="fieldset-legend">Notify me about</legend> <label class="check"><input type="checkbox" class="checkbox" checked> Failed deployments</label> <label class="check"> <input type="checkbox" class="checkbox" checked> Expiring certificates </label> <label class="check"><input type="checkbox" class="checkbox"> Product news</label> </fieldset></template>#停用
停用
<div class="field"> <label for="custom-domain">Custom domain</label> <input class="input" id="custom-domain" value="atlas.dev" disabled aria-describedby="custom-domain-reason"> <span class="field-hint" id="custom-domain-reason">Custom domains come with the Team plan.</span></div><div className="field"> <label htmlFor="custom-domain">Custom domain</label> <input className="input" id="custom-domain" defaultValue="atlas.dev" disabled aria-describedby="custom-domain-reason" /> <span className="field-hint" id="custom-domain-reason"> Custom domains come with the Team plan. </span></div><div class="field"> <label for="custom-domain">Custom domain</label> <input class="input" id="custom-domain" value="atlas.dev" disabled aria-describedby="custom-domain-reason"> <span class="field-hint" id="custom-domain-reason">Custom domains come with the Team plan.</span></div><template> <div class="field"> <label for="custom-domain">Custom domain</label> <input class="input" id="custom-domain" value="atlas.dev" disabled aria-describedby="custom-domain-reason"> <span class="field-hint" id="custom-domain-reason"> Custom domains come with the Team plan. </span> </div></template>#React、Svelte 與 Vue
field 元件透過 ID 將標籤、控制項、提示和錯誤訊息串接起來。控制項沿用頁面自己的標記,本頁其餘範例也都以標記實作。執行 npx master-ui add field 將元件複製到專案。元件的建構與使用方式請見 React、Svelte 與 Vue。
#類別
| 類別 | 說明 |
|---|---|
input | 將文字輸入欄位、檔案輸入欄位或 textarea 呈現為凹槽,也適用於瀏覽器的日期、時間、數字、搜尋和色彩欄位 |
input-sm | 高度為 32px,預設高度為 38px(與按鈕同高)搭配 input 使用 |
input-lg | 高度為 44px,預設高度為 38px(與按鈕同高)搭配 input 使用 |
input-auto | textarea 隨內容增高,從 --input-rows 行增至 --input-max-rows 行,超出後即可捲動搭配 input 使用 |
input-group | 以同一個凹槽包住無外框的欄位及其圖示、附加部件或按鈕。凹槽會反映欄位的指標懸停、焦點、無效和停用狀態。 |
input-group-sm | 高度為 32px 的群組,預設為 38px搭配 input-group 使用 |
input-group-lg | 高度為 44px 的群組,預設為 38px搭配 input-group 使用 |
input-group-wrap | 群組以膠囊標籤收納多個值,並隨換行增高。新增或移除值由頁面本身的腳本處理,或透過一次伺服器請求與回應完成。搭配 input-group 使用 |
input-group-field | 群組內未套用外觀樣式的原生欄位,保留原生語意和文字游標 |
input-group-addon | 顯示於值旁的固定文字,例如通訊協定、單位或網域 |
field | 標籤疊在控制項上方,下方可加說明。只包含文字和控制項時可用 label 元素;有提示或錯誤訊息時,改用包含帶 for 的 label 的 div,讓說明成為控制項的描述,而不是名稱的一部分 |
field-hint | 控制項下方的低對比提示文字。欄位顯示錯誤時會暫時隱藏提示 |
field-error | 欄位內有控制項未通過驗證時,才顯示錯誤訊息 |
field-help | 標籤後面的問號,使用柔和的前景色並加上點狀底線,用來顯示工具提示:一顆以 interestfor 和 popovertarget 指向該工具提示的按鈕。它與標籤並排在同一列,不可放在標籤內 |
fieldset | 使用 fieldset 將相關控制項歸在同一個群組標題下,並移除瀏覽器預設的凹槽邊框 |
fieldset-legend | 以 legend 元素呈現群組標題,並套用欄位標籤的樣式 |
#自訂屬性
| 屬性 | 預設值 | 說明 |
|---|---|---|
--input-height | 2.375rem | 輸入欄位或輸入群組在區塊方向的最小尺寸,適用於所有指標類型。 |
--input-padding-x | .75rem | 輸入欄位或輸入群組在行內方向的內距 |
--input-font-size | .875rem | 文字大小 |
--input-radius | var(--radius-control) | 圓角半徑為 10px,小型為 8px,大型為 12px |
--input-rows | 3 | input-auto textarea 顯示的最少行數設定於 input-auto |
--input-max-rows | 12 | input-auto textarea 開始捲動前可自動增高到的最大行數。設定於 input-auto |