跳到正文
GitHub

基础

空间与形状

页面的边距、几种度量宽度,以及四个圆角。

度量宽度以 ch 而不是 px 为上限,所以它跟随它所排的字。--measure-record 是列表记录描述文字的天花板,不是宽度:更窄的栏依然胜出。

圆角只有四级,没有第五级。50% 的圆是几何形状而不是圆角,所以它不算一级。

每个组件都用逻辑属性书写——ps-/pe- 而不是 pl-/pr-,start-/end- 而不是 left-/right-——所以从右到左的文档不需要自己的样式表就能镜像。构建时有测试会因为一个物理属性而失败:事后给四十个组件补方向支持,是没人会排期的清扫,而且它出错时没有任何声音。上面任何一个例子都可以切到 RTL 看看。

布局

布局 tokens
Token备注
--maxw1288px
--col8.3333%
--row52px
--padclamp(18px, calc(4.4 * var(--fluid)), 64px)in-card title 18 → 20px
--secclamp(54px, calc(7 * var(--fluid)), 96px)
--sec-tightclamp(40px, calc(5 * var(--fluid)), 68px)
--secondary-textvar(--ink-3-aa)
--page-padvar(--pad)─── Layout ─────────────────────────────────────────────────────────────
--w-pagevar(--maxw)
--w-reading46remCaps the prose track only, which is what a 73ch measure is for.
--measure-record66chThe cap on a listed record's description — a row, a card, a CV entry. In `ch` rather than px so it tracks the type it is set in, and one token rather than the six hand-picked widths surfaces had drifted into. A ceiling, not a width: a narrower column still wins.
--scroll-offset88pxHow far below the viewport top an anchored heading comes to rest — a fixed masthead plus a line of air.

圆角

圆角 tokens
Token备注
--radius-sm6px─── Radius ───────────────────────────────────────────────────────────── Four steps, and there is no fifth. The old law was "0 everywhere"; the White Reset replaces that with a scale small enough to stay quiet on a white page. A 50% circle is geometry rather than a corner and is not a step here.
--radius8pximages, thumbnails, media frames
--radius-lg14pxinputs, buttons, small plates
--radius-pill999pxfeature panels, dark plates

密度

第二条主题轴,也是唯一的另一条。在任何容器上写 data-density="compact",它下面所有控件一起收紧,不需要逐个告知。默认状态下一个中号控件是 44px,也就是 WCAG 2.5.5 要求的指针目标;紧凑模式降到 36px,仍然宽裕地通过 2.5.8,但不再满足 2.5.5。它是给鼠标驱动的密集桌面工具用的,是一笔真实的取舍而不是白拿。上面任何一个例子都可以切过去看。

密度 tokens
Token备注
--control-h-sm1.875rem
--control-h-md2.25rem30px
--control-h-lg2.5rem36px — clears WCAG 2.5.8, not 2.5.5
--control-px-sm0.75rem40px
--control-px-md1rem
--control-px-lg1.25rem
--control-py-sm0.25rem
--control-py-md0.375rem
--control-py-lg0.5rem
--control-gap0.5rem
--field-px0.625rem
--field-py0.375rem

图标

图标 tokens
Token备注
--ico-s14px─── Icons ─── one stroke weight, three sizes.
--ico-m16px
--ico-l20px
--ico-stroke1.5

层叠顺序

层叠顺序 tokens
Token备注
--z-rule1─── Stacking ─── seven ranks, named for what sits at each.
--z-sticky10
--z-drawer100
--z-scrim200
--z-modal210
--z-palette220
--z-toast300
--z-dropdownvar(--z-drawer)─── Stacking ─── five component-facing names onto the seven ranks. ─────
--z-overlayvar(--z-scrim)