Harbor
harbor.dev · 2 hours ago
Ready平台
瀏覽器有適用的原生元素或功能時,元件就會使用它。可以逐一試用,所有範例都不會載入腳本。
瀏覽器支援一排投影片會自動對齊,瀏覽器會加上上一張、下一張按鈕,以及每張投影片對應的圓點。
::scroll-button() ::scroll-marker scroll-snap
a1f9e2cReady7c04b1dReadye55d0a8Building按下「發布」會開啟強制回應對話框,將焦點留在框內。按 Escape 或點選遮罩即可關閉。開啟與關閉都有緩動效果,關閉後焦點會回到原處。
<dialog> commandfor closedby @starting-style
brand-guidelines.pdf
在按鈕旁開啟,碰到檢視區邊緣時會改往反方向展開。按 Esc 鍵或點擊外部即可關閉。
popover position-area
指標移到工具上或工具取得鍵盤焦點時,會顯示名稱與快速鍵,提示不會擋住點擊。
popover="hint" interestfor
1.28M this week · up 12.4%
分段控制項的滑塊繪製在錨點上,並滑向目前選項;長條進場時從基線向上延伸。
anchor-scope anchor() @starting-style
選單在依附於控制項的彈出面板中展開,並在目前選項旁顯示勾號。
appearance: base-select ::picker(select)
Design review
The focus ring is cut by the mask on the code panel. Should it move to the group?
Yes. The group already has the corner, so the ring follows it.
輸入框預設為一行,隨輸入增高至十行,之後改在框內捲動。上方的對話串維持原位。
field-sizing: content
展開一列時,同名的其他列會收合,各面板透過 interpolate-size 平滑調整高度。
::details-content interpolate-size details[name]
捲動驅動的動畫會依捲軸滑塊的位置,從軌道起點填色至滑塊。
view-timeline timeline-scope
自訂
顏色、圓角與陰影都由主題 token 定義。只要調整 token,就能改變整套元件的外觀,省去覆寫樣式的步驟。
選擇自訂方式伊爾瑟湖環線
6.2 公里 · 2 小時 10 分鐘
船屋
起點 · 0.0 km
落葉松山稜
2.6 公里
山頂
4.1 公里
伊爾瑟湖環線
6.2 公里 · 2 小時 10 分鐘
船屋
起點 · 0.0 km
落葉松山稜
2.6 公里
山頂
4.1 公里
伊爾瑟湖環線
6.2 公里 · 2 小時 10 分鐘
船屋
起點 · 0.0 km
落葉松山稜
2.6 公里
山頂
4.1 公里
伊爾瑟湖環線
6.2 公里 · 2 小時 10 分鐘
船屋
起點 · 0.0 km
落葉松山稜
2.6 公里
山頂
4.1 公里
themes/editorial.css51 個 token
/* themes/editorial.css, imported after '@master/ui' */@theme { /* Type */ --font-sans: 'Iowan Old Style', Charter, Georgia, serif; --font-weight-control: 400; /* Shape: tight corners, and nothing travels */ --radius-chip: .125rem; --radius-control-sm: .125rem; --radius-control: .1875rem; --radius-control-lg: .25rem; --radius-surface: .25rem; --lift: 0px; /* Surfaces: cream paper, and newsprint at night */ --color-surface-base: light-dark(oklch(96.4% .014 84), oklch(19.5% .008 70)); --color-surface-raised: light-dark(oklch(98.6% .009 86), oklch(22.5% .009 70)); --color-surface-raised-low: var(--color-surface-raised); --color-surface-inset: light-dark(oklch(94.4% .016 84), oklch(17% .008 70)); --color-surface-inset-hover: light-dark(oklch(92.8% .018 84), oklch(15.8% .008 70)); --color-surface-chip: light-dark(oklch(93.4% .017 84), oklch(100% 0 none / .07)); --color-surface-inverse: light-dark(oklch(44% .15 27), oklch(68% .14 30)); /* Lines carry every edge */ --color-line-hair: light-dark(oklch(25% .02 60 / .14), oklch(95% .02 84 / .13)); --color-line-contour: light-dark(oklch(25% .02 60 / .3), oklch(95% .02 84 / .26)); --color-line-divider: light-dark(oklch(25% .02 60 / .22), oklch(95% .02 84 / .2)); --color-line-strong: light-dark(oklch(25% .02 60 / .5), oklch(95% .02 84 / .44)); --color-line-mark: light-dark(oklch(25% .02 60 / .75), oklch(95% .02 84 / .66)); /* Ink: warm black, and an oxblood accent */ --color-text-strong: light-dark(oklch(21% .014 55), oklch(94% .014 84)); --color-text-body: light-dark(oklch(33% .016 55), oklch(84% .014 84)); --color-text-muted: light-dark(oklch(46% .018 60), oklch(71% .014 80)); --color-text-inverse: light-dark(oklch(97.5% .01 84), oklch(18% .01 40)); --color-focus: var(--color-text-strong); --color-ink-high: var(--color-surface-inverse); --color-ink-low: var(--color-surface-inverse); --color-ink-high-hover: light-dark(oklch(49% .16 27), oklch(73% .13 30)); --color-ink-low-hover: var(--color-ink-high-hover); --color-ink-pressed: light-dark(oklch(39% .14 27), oklch(62% .14 30)); --color-ink-highlight: transparent; --color-ink-edge: transparent; /* Depth: a rule, not a shadow */ --color-highlight: transparent; --color-lip: transparent; --color-shade-1: transparent; --color-shade-2: transparent; --color-shade-3: transparent; --color-shade-4: transparent; --color-shade-5: transparent; --shadow-pressed: inset 0 0 0 1px var(--color-line-contour); --shadow-flat: 0 0 0 1px var(--color-line-contour); --shadow-raised: 0 0 0 1px var(--color-line-strong); --shadow-raised-hover: 0 0 0 1px var(--color-line-mark); --shadow-lifted: 0 0 0 1px var(--color-line-contour); --shadow-ink: 0 0 0 0 transparent; --shadow-ink-hover: 0 0 0 0 transparent; --shadow-ink-pressed: 0 0 0 0 transparent; --shadow-ink-well: 0 0 0 0 transparent; --shadow-thumb-on-ink: 0 0 0 0 transparent;} /* Circles in place of squircles */:root { --corner-shape: round; --corner-scale: 1;}themes/technical.css51 個 token
/* themes/technical.css, imported after '@master/ui' */@theme { /* Type: load the font before selecting it */ --font-sans: 'IBM Plex Mono', ui-monospace, monospace; --font-weight-control: 500; /* Shape: square, and nothing travels */ --radius-chip: 0; --radius-control-sm: 0; --radius-control: 0; --radius-control-lg: 0; --radius-surface: 0; --lift: 0px; /* Surfaces: drafting film, and a navy console */ --color-surface-base: light-dark(oklch(96.8% .005 240), oklch(17.5% .014 250)); --color-surface-raised: light-dark(oklch(99.5% .002 240), oklch(21% .016 250)); --color-surface-raised-low: var(--color-surface-raised); --color-surface-inset: light-dark(oklch(95% .006 240), oklch(15% .014 250)); --color-surface-inset-hover: light-dark(oklch(93.5% .007 240), oklch(13.8% .014 250)); --color-surface-chip: light-dark(oklch(94% .008 240), oklch(100% 0 none / .07)); --color-surface-inverse: light-dark(oklch(52% .2 258), oklch(76% .13 236)); /* Lines: crisp, and a step cooler */ --color-line-hair: light-dark(oklch(30% .03 250 / .12), oklch(85% .05 240 / .12)); --color-line-contour: light-dark(oklch(30% .03 250 / .26), oklch(85% .05 240 / .24)); --color-line-divider: light-dark(oklch(30% .03 250 / .18), oklch(85% .05 240 / .17)); --color-line-strong: light-dark(oklch(30% .03 250 / .42), oklch(85% .05 240 / .38)); --color-line-mark: light-dark(oklch(30% .03 250 / .62), oklch(85% .05 240 / .6)); /* Ink: cobalt for what is on */ --color-text-strong: light-dark(oklch(20% .02 255), oklch(95% .01 240)); --color-text-body: light-dark(oklch(35% .02 255), oklch(82% .015 240)); --color-text-muted: light-dark(oklch(49% .02 250), oklch(69% .02 240)); --color-text-inverse: light-dark(oklch(99% 0 none), oklch(16% .02 250)); --color-focus: var(--color-surface-inverse); --color-ink-high: var(--color-surface-inverse); --color-ink-low: var(--color-surface-inverse); --color-ink-high-hover: light-dark(oklch(57% .2 258), oklch(81% .11 236)); --color-ink-low-hover: var(--color-ink-high-hover); --color-ink-pressed: light-dark(oklch(46% .19 258), oklch(70% .13 236)); --color-ink-highlight: transparent; --color-ink-edge: transparent; --color-thumb-on-high: light-dark(oklch(100% 0 none), oklch(16% .02 250)); --color-thumb-on-low: var(--color-thumb-on-high); /* Depth: one 1px line */ --color-highlight: transparent; --color-lip: transparent; --color-shade-1: transparent; --color-shade-2: transparent; --color-shade-3: transparent; --color-shade-4: transparent; --color-shade-5: transparent; --shadow-pressed: inset 0 0 0 1px var(--color-line-contour); --shadow-flat: 0 0 0 1px var(--color-line-contour); --shadow-raised: 0 0 0 1px var(--color-line-strong); --shadow-raised-hover: 0 0 0 1px var(--color-line-mark); --shadow-lifted: 0 0 0 1px var(--color-line-strong); --shadow-ink: 0 0 0 0 transparent; --shadow-ink-hover: 0 0 0 0 transparent; --shadow-ink-pressed: 0 0 0 0 transparent; --shadow-ink-well: 0 0 0 0 transparent; --shadow-thumb-on-ink: 0 0 0 0 transparent;}themes/soft.css42 個 token
/* themes/soft.css, imported after '@master/ui' */@theme { /* Type: the font you have, a step heavier */ --font-weight-control: 520; /* Shape: controls round off to pills */ --radius-chip: .75rem; --radius-control-sm: 1rem; --radius-control: 1.1875rem; --radius-control-lg: 1.375rem; --radius-surface: 1.75rem; --lift: 1px; /* Surfaces: lavender, and plum at night */ --color-surface-base: light-dark(oklch(96.6% .016 300), oklch(20.5% .03 295)); --color-surface-raised: light-dark(oklch(99.6% .004 300), oklch(27% .035 295)); --color-surface-raised-low: light-dark(oklch(98.2% .009 300), oklch(25% .034 295)); --color-surface-inset: light-dark(oklch(94.6% .02 300), oklch(18.5% .03 295)); --color-surface-inset-hover: light-dark(oklch(93.2% .024 300), oklch(17.2% .03 295)); --color-surface-chip: light-dark(oklch(94.4% .02 300), oklch(100% 0 none / .08)); --color-surface-inverse: light-dark(oklch(55% .19 292), oklch(80% .11 292)); /* Lines: faint, and tinted */ --color-line-hair: light-dark(oklch(35% .1 295 / .08), oklch(92% .05 295 / .09)); --color-line-contour: light-dark(oklch(35% .1 295 / .12), oklch(92% .05 295 / .14)); --color-line-divider: light-dark(oklch(35% .1 295 / .1), oklch(92% .05 295 / .12)); --color-line-strong: light-dark(oklch(35% .1 295 / .2), oklch(92% .05 295 / .22)); --color-line-mark: light-dark(oklch(35% .1 295 / .34), oklch(92% .05 295 / .36)); /* Ink: violet for what is on */ --color-text-strong: light-dark(oklch(25% .05 295), oklch(95% .02 300)); --color-text-body: light-dark(oklch(40% .05 295), oklch(84% .03 300)); --color-text-muted: light-dark(oklch(51% .05 295), oklch(73% .04 300)); --color-text-inverse: light-dark(oklch(99% .005 300), oklch(20% .04 295)); --color-focus: var(--color-surface-inverse); --color-ink-high: light-dark(oklch(62% .18 292), oklch(86% .09 292)); --color-ink-low: light-dark(oklch(53% .2 290), oklch(77% .12 290)); --color-ink-high-hover: light-dark(oklch(66% .17 292), oklch(89% .08 292)); --color-ink-low-hover: light-dark(oklch(57% .19 290), oklch(81% .11 290)); --color-ink-pressed: light-dark(oklch(48% .19 290), oklch(72% .13 290)); --color-ink-edge: light-dark(oklch(46% .18 290), oklch(0% 0 none / .4)); --color-thumb-on-high: light-dark(oklch(100% 0 none), oklch(22% .04 295)); --color-thumb-on-low: light-dark(oklch(97% .01 300), oklch(20% .04 295)); /* Depth: wide, tinted shade */ --color-shade-1: light-dark(oklch(40% .12 295 / .07), oklch(5% .02 295 / .45)); --color-shade-2: light-dark(oklch(40% .12 295 / .07), oklch(5% .02 295 / .36)); --color-shade-3: light-dark(oklch(40% .12 295 / .08), oklch(5% .02 295 / .32)); --color-shade-4: light-dark(oklch(40% .12 295 / .1), oklch(5% .02 295 / .32)); --color-shade-5: light-dark(oklch(40% .12 295 / .14), oklch(5% .02 295 / .4)); --shadow-raised: inset 0 1px 0 var(--color-highlight), 0 0 0 .5px var(--color-line-contour), 0 2px 6px -2px var(--color-shade-1), 0 8px 18px -8px var(--color-shade-3); --shadow-raised-hover: inset 0 1px 0 var(--color-highlight), 0 0 0 .5px var(--color-line-strong), 0 4px 10px -3px var(--color-shade-2), 0 14px 28px -10px var(--color-shade-4); --shadow-lifted: inset 0 1px 0 var(--color-highlight), 0 0 0 .5px var(--color-line-contour), 0 6px 16px -6px var(--color-shade-2), 0 28px 60px -24px var(--color-shade-5); --shadow-ink: inset 0 1px 0 oklch(100% 0 none / .3), 0 0 0 .5px var(--color-ink-edge), 0 6px 16px -6px light-dark(oklch(50% .2 290 / .55), oklch(0% 0 none / .5)); --shadow-ink-hover: inset 0 1px 0 oklch(100% 0 none / .34), 0 0 0 .5px var(--color-ink-edge), 0 10px 22px -8px light-dark(oklch(50% .2 290 / .6), oklch(0% 0 none / .55));}themes/bold.css52 個 token
/* themes/bold.css, imported after '@master/ui' */@theme { /* Type: the font you have, at its boldest */ --font-weight-control: 700; /* Shape: plain circular corners, and a long press */ --radius-chip: .25rem; --radius-control-sm: .375rem; --radius-control: .5rem; --radius-control-lg: .625rem; --radius-surface: .75rem; --lift: 2px; /* Surfaces: butter and white, or black */ --color-surface-base: light-dark(oklch(95.5% .04 92), oklch(16% .005 280)); --color-surface-raised: light-dark(oklch(100% 0 none), oklch(22% .006 280)); --color-surface-raised-low: var(--color-surface-raised); --color-surface-inset: light-dark(oklch(93% .045 92), oklch(14% .005 280)); --color-surface-inset-hover: light-dark(oklch(90.5% .055 92), oklch(12% .005 280)); --color-surface-chip: light-dark(oklch(92% .05 92), oklch(100% 0 none / .1)); --color-surface-inverse: oklch(87% .175 95); /* Lines: solid ink, 2px wide */ --color-line-hair: light-dark(oklch(15% 0 none / .2), oklch(96% .02 95 / .2)); --color-line-contour: light-dark(oklch(15% 0 none), oklch(96% .02 95)); --color-line-divider: light-dark(oklch(15% 0 none / .35), oklch(96% .02 95 / .3)); --color-line-strong: var(--color-line-contour); --color-line-mark: var(--color-line-contour); /* Ink: yellow for what is on, in both schemes */ --color-text-strong: light-dark(oklch(15% 0 none), oklch(97% .02 95)); --color-text-body: light-dark(oklch(22% 0 none), oklch(90% .02 95)); --color-text-muted: light-dark(oklch(38% .01 90), oklch(77% .02 95)); --color-text-inverse: oklch(15% 0 none); --color-focus: light-dark(oklch(15% 0 none), oklch(87% .175 95)); --color-ink-high: var(--color-surface-inverse); --color-ink-low: var(--color-surface-inverse); --color-ink-high-hover: oklch(90% .16 95); --color-ink-low-hover: var(--color-ink-high-hover); --color-ink-pressed: oklch(81% .17 90); --color-ink-highlight: transparent; --color-ink-edge: var(--color-line-contour); --color-thumb-on-high: oklch(15% 0 none); --color-thumb-on-low: oklch(15% 0 none); /* Depth: a hard shadow, offset */ --color-highlight: transparent; --color-lip: transparent; --color-shade-1: transparent; --color-shade-2: transparent; --color-shade-3: transparent; --color-shade-4: transparent; --color-shade-5: transparent; --shadow-pressed: inset 0 0 0 2px var(--color-line-contour); --shadow-flat: 0 0 0 2px var(--color-line-contour); --shadow-raised: 0 0 0 2px var(--color-line-contour), 3px 3px 0 2px var(--color-line-contour); --shadow-raised-hover: 0 0 0 2px var(--color-line-contour), 5px 5px 0 2px var(--color-line-contour); --shadow-lifted: 0 0 0 2px var(--color-line-contour), 6px 6px 0 2px var(--color-line-contour); --shadow-ink: var(--shadow-raised); --shadow-ink-hover: var(--shadow-raised-hover); --shadow-ink-pressed: var(--shadow-pressed); --shadow-ink-well: inset 0 0 0 2px var(--color-line-contour); --shadow-thumb-on-ink: 0 0 0 0 transparent;} /* Circles in place of squircles */:root { --corner-shape: round; --corner-scale: 1;}優先使用 HTML
在原生元素加上 class,就是一個元件,因此同一份標記在純 HTML、React、Svelte 和 Vue 中都能直接使用。瀏覽器從一份樣式表繪製外觀,依元素本身的屬性呈現各種狀態。無須安裝額外的執行環境,也不需要 hydration。
框架元件<section class="card">
<header class="card-header">
<h3 class="card-title">Preview deployments</h3>
<p class="card-description">A URL for every pull request.</p>
<input type="checkbox" role="switch" class="switch card-action"
checked aria-label="Preview deployments">
</header>
<div class="card-body">
<label class="field">
Branch pattern
<input class="input" value="feature/*">
</label>
</div>
<footer class="card-footer">
<button type="button" class="btn btn-sm">Reset</button>
<button type="button" class="btn btn-sm btn-primary">Save</button>
</footer>
</section>export function PreviewDeployments() {
return (
<section className="card">
<header className="card-header">
<h3 className="card-title">Preview deployments</h3>
<p className="card-description">A URL for every pull request.</p>
<input type="checkbox" role="switch" className="switch card-action"
defaultChecked aria-label="Preview deployments" />
</header>
<div className="card-body">
<label className="field">
Branch pattern
<input className="input" defaultValue="feature/*" />
</label>
</div>
<footer className="card-footer">
<button type="button" className="btn btn-sm">Reset</button>
<button type="button" className="btn btn-sm btn-primary">Save</button>
</footer>
</section>
)
}<section class="card">
<header class="card-header">
<h3 class="card-title">Preview deployments</h3>
<p class="card-description">A URL for every pull request.</p>
<input type="checkbox" role="switch" class="switch card-action"
checked aria-label="Preview deployments">
</header>
<div class="card-body">
<label class="field">
Branch pattern
<input class="input" value="feature/*">
</label>
</div>
<footer class="card-footer">
<button type="button" class="btn btn-sm">Reset</button>
<button type="button" class="btn btn-sm btn-primary">Save</button>
</footer>
</section><template>
<section class="card">
<header class="card-header">
<h3 class="card-title">Preview deployments</h3>
<p class="card-description">A URL for every pull request.</p>
<input type="checkbox" role="switch" class="switch card-action"
checked aria-label="Preview deployments">
</header>
<div class="card-body">
<label class="field">
Branch pattern
<input class="input" value="feature/*">
</label>
</div>
<footer class="card-footer">
<button type="button" class="btn btn-sm">Reset</button>
<button type="button" class="btn btn-sm btn-primary">Save</button>
</footer>
</section>
</template>僅由樣式表繪製
A URL for every pull request.
<div class="toast-region" role="region"
aria-label="Notifications" aria-live="polite">
<dialog open class="toast toast-success" aria-labelledby="forge-toast">
<svg class="icon toast-icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<circle cx="8" cy="8" r="6"/>
<path d="M5 8L7.1041 9.8703A0.2 0.2 0 0 0 7.3832
9.8573L10.75 6.25"/>
</svg>
<div class="toast-body">
<p class="toast-title" id="forge-toast">Deployed to production</p>
<p class="toast-description">atlas.dev is live in 14 regions.</p>
</div>
<form method="dialog" class="toast-close">
<button class="btn btn-quiet btn-square btn-sm" aria-label="Dismiss">
<svg class="icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<path d="M4 4L12 12"/>
<path d="M4 12L12 4"/>
</svg>
</button>
</form>
</dialog>
</div>export function DeployedToast() {
return (
<div className="toast-region" role="region"
aria-label="Notifications" aria-live="polite">
<dialog open className="toast toast-success" aria-labelledby="forge-toast">
<svg className="icon toast-icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" strokeLinecap="round">
<circle cx="8" cy="8" r="6"/>
<path d="M5 8L7.1041 9.8703A0.2 0.2 0 0 0 7.3832
9.8573L10.75 6.25"/>
</svg>
<div className="toast-body">
<p className="toast-title" id="forge-toast">Deployed to production</p>
<p className="toast-description">atlas.dev is live in 14 regions.</p>
</div>
<form method="dialog" className="toast-close">
<button className="btn btn-quiet btn-square btn-sm" aria-label="Dismiss">
<svg className="icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" strokeLinecap="round">
<path d="M4 4L12 12"/>
<path d="M4 12L12 4"/>
</svg>
</button>
</form>
</dialog>
</div>
)
}<div class="toast-region" role="region"
aria-label="Notifications" aria-live="polite">
<dialog open class="toast toast-success" aria-labelledby="forge-toast">
<svg class="icon toast-icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<circle cx="8" cy="8" r="6"/>
<path d="M5 8L7.1041 9.8703A0.2 0.2 0 0 0 7.3832
9.8573L10.75 6.25"/>
</svg>
<div class="toast-body">
<p class="toast-title" id="forge-toast">Deployed to production</p>
<p class="toast-description">atlas.dev is live in 14 regions.</p>
</div>
<form method="dialog" class="toast-close">
<button class="btn btn-quiet btn-square btn-sm" aria-label="Dismiss">
<svg class="icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<path d="M4 4L12 12"/>
<path d="M4 12L12 4"/>
</svg>
</button>
</form>
</dialog>
</div><template>
<div class="toast-region" role="region"
aria-label="Notifications" aria-live="polite">
<dialog open class="toast toast-success" aria-labelledby="forge-toast">
<svg class="icon toast-icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<circle cx="8" cy="8" r="6"/>
<path d="M5 8L7.1041 9.8703A0.2 0.2 0 0 0 7.3832
9.8573L10.75 6.25"/>
</svg>
<div class="toast-body">
<p class="toast-title" id="forge-toast">Deployed to production</p>
<p class="toast-description">atlas.dev is live in 14 regions.</p>
</div>
<form method="dialog" class="toast-close">
<button class="btn btn-quiet btn-square btn-sm" aria-label="Dismiss">
<svg class="icon" viewBox="0 0 16 16" aria-hidden="true"
fill="none" stroke="currentColor" stroke-linecap="round">
<path d="M4 4L12 12"/>
<path d="M4 12L12 4"/>
</svg>
</button>
</form>
</dialog>
</div>
</template>僅由樣式表繪製
<div class="segmented" role="radiogroup" aria-label="View">
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="list" checked>
List
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="board">
Board
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="timeline">
Timeline
</label>
</div>export function ViewSwitch() {
return (
<div className="segmented" role="radiogroup" aria-label="View">
<label className="segmented-item">
<input type="radio" className="segmented-input"
name="forge-view" value="list" defaultChecked />
List
</label>
<label className="segmented-item">
<input type="radio" className="segmented-input"
name="forge-view" value="board" />
Board
</label>
<label className="segmented-item">
<input type="radio" className="segmented-input"
name="forge-view" value="timeline" />
Timeline
</label>
</div>
)
}<div class="segmented" role="radiogroup" aria-label="View">
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="list" checked>
List
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="board">
Board
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="timeline">
Timeline
</label>
</div><template>
<div class="segmented" role="radiogroup" aria-label="View">
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="list" checked>
List
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="board">
Board
</label>
<label class="segmented-item">
<input type="radio" class="segmented-input"
name="forge-view" value="timeline">
Timeline
</label>
</div>
</template>僅由樣式表繪製
下列任一項由框架管理時,就會提供框架元件
成本
每個元件都有獨立的樣式表,共用同一個主題,多數元件無須腳本。選取頁面會用到的元件。各項大小均於建置時量測。
尚未選取
從「全部」中選取頁面會用到的項目。
編譯後的大小(kB)JS 需要搭配腳本JS? 腳本可選用
| 樣式表 | 腳本 | 編譯後(kB) |
|---|---|---|
| 外觀 | 無 | 20.5 |
| 卡片 | 無 | 6.0 |
| 分類色 搭配 輸入欄位 | 無 | 5.8 |
| 圖示 搭配 按鈕 | 無 | 0.3 |
| 按鈕 | 無 | 11.5 |
| 輸入欄位 | 無 | 20.0 |
| 下拉選單 | 無 | 8.2 |
| 核取方塊 | 無 | 3.7 |
| 開關 | 無 | 3.3 |
| 膠囊標籤 搭配 輸入欄位 | 無 | 7.9 |
| 分頁標籤 | tabs.js, optional | 3.0 |
| 對話框 | drawer.js, optional | 10.3 |
| 工具提示 | 無 | 3.0 |
| 旋轉指示器 搭配 按鈕 | 無 | 1.2 |
| 頭像 搭配 輸入欄位 | avatar.js, optional | 4.2 |
| 徽章 | 無 | 6.7 |
| 按鍵 搭配 輸入欄位 | 無 | 0.9 |
16 份樣式表
CSS(gzip 壓縮後)
18.0kB
占整個元件庫的 21%,經 gzip 壓縮後為 87.2 kB
編譯後為 116.5 kB:主題只計一次,再加上 16 份樣式表。 其中 6 份會隨其他元件一起載入。
JavaScript(gzip 壓縮後)
0kB
占全部行為模組的 0%,經 gzip 壓縮後為 94.9 kB
無需腳本,所有狀態都由原生元素及其屬性呈現。 標記為選用的項目不列入計算。
drawer.js供 對話框 選用1.8 kBtabs.js供 分頁標籤 選用1.4 kBdist/standalone.css時相同,保留未精簡的程式碼,再整份以 gzip 壓縮。各部分壓縮後的大小無法直接相加,因此本頁會從發布的檔案擷取每組選取的內容,分別進行 gzip 壓縮。base.css在專案沒有自己的重設樣式時,會增加 1.7 kB(gzip 壓縮後)。internal.js由 19 個行為共用,只計算一次。1 kB 等於 1,000 位元組。比較項目
分別用 Master UI 和 shadcn/ui 建置六個常用元件的正式版本,再以同一支腳本量測。 六個元件放在同一頁,以 gzip 壓縮後,Master UI 為 12.8 kB,搭配 Base UI 的 shadcn/ui 為 149.2 kB。差距來自 JavaScript。
查看並執行效能測試| 組成部分 | 首次載入(gzip 壓縮後), kB總計CSSJS |
|---|---|
| 僅計設定無元件 | |
| 按鈕 | |
| 卡片 | |
| 對話框 | |
| 分頁標籤Master UI:tabs.js | |
| 下拉選單Master UI:原生元素,無需腳本 | |
| 工具提示 | |
| 全部六個11.7× 使用 Master UI 時體積更小6.4× 使用 Master UI 時體積更小10.0× 使用 Master UI 時體積更小4.7× 使用 Master UI 時體積更小 |
契約
每個元件都附有契約,列出類別、狀態、操作按鍵與適用情境,並提供一個正確範例。AI 代理先讀契約再撰寫標記,檢查器會標出違反契約的標記。
@master/ui/check 於本頁建置時適用於立即生效的設定。珠光滑塊會滑到墨色區域。
可開啟或關閉的設定,切換後立即生效,無須另按儲存。
<input type="checkbox" role="switch">labelof switchexclusive: sizeof switchexclusive: size:checkeddisabled狀態一律用屬性或虛擬類別標記,禁止使用類別。
檔案內其他項目: instead · composes
settings.html初稿
<label class="check"> <input type="checkbox" class="switch switch-on" checked> Email notifications</label>終端機exit 1
npx master-ui check settings.htmlsettings.html:2:3 error attribute "switch" needs role="switch" on its element.settings.html:2:3 warning unknown-class "switch-on" is not a class of switch. It has: switch, switch-sm, switch-lg.1 files checked: 1 errors, 1 warnings.行 2, 依範例改寫
之前: <input type="checkbox" class="switch switch-on" checked>之後: <input type="checkbox" role="switch" class="switch" checked>終端機exit 0
npx master-ui check settings.html1 files checked: 0 errors, 0 warnings./tw/llms.txt撰寫 Master UI 標記的規則,以及各頁的 Markdown 版本連結。
/contracts.json每份契約都以資料形式提供,供產生標記的程式使用。
npx skills add master-co/ui --skill master-ui讓代理程式閱讀契約、檢查標記,並在瀏覽器中驗證結果的技能。
npx master-ui add <name>React、Svelte 和 Vue 元件可直接以原始碼複製到專案,也透過 shadcn 風格的登錄庫提供。
元件庫
元件附有即時預覽、標記,以及供程式開發代理讀取的契約。圖表以二十多種形式呈現資料。區塊將元件組成產品的各個部分,頁面則為整個畫面搭好框架。每一項都能複製到自己的專案中保留。
安裝套件、匯入樣式表,再為原生元素加上 class。每個元件都能在純 HTML 和任何框架中使用。