跳到正文
册页

基础

高度

没有东西会浮起来。四个阴影 token 的存在,就是为了保证这一点。

这里没有高度阶梯,而那四个以阶梯命名的 token,存在就是为了把它中和掉。--shadow-sm、--shadow 和 --shadow-lg 全部解析为 none,--shadow-color 解析为 transparent。这不是一处等着被补上的疏漏:从一套带阴影的系统移植过来的组件保留着它的 shadow class,什么都画不出来,保持平的——声明它们的全部意义就在这里。第二条法则——box-shadow 永远不带模糊——是由取值执行的,不是由评审者执行的。

这套系统真正拥有的唯一一个深度线索是 --lift:3px 3px 0 0 var(--shadow-offset),一道完全不带模糊的硬墨偏移,以及 2px 的 --lift-sm。--shadow-offset 指向 --clay,所以这道偏移是强调色而不是灰色,强调色一改它就跟着改。在伸手去用之前值得知道:包里没有任何组件用过这两个中的任何一个——整个库里一个 shadow-(--lift) 都没有。它是作为一种经过认可的写法发布给自己做反色版面的使用者的,不是库自己倚仗的东西。

库真正用来分隔的是三样东西,按这个顺序。发丝线:行与行之间是 --rule,盒子四周是 --rule-2。换底色:--paper、--paper-2、--stone,三级,没有第四级。以及反色,也就是 Card variant="plate" 伸手去拿的那一样——它用那唯一一块反色表面填充,并自带标题颜色,因为写死的墨色标题落在反色版面上只有 1.25:1,在唯一一个全部职责就是长得不一样的变体上反而看不见。一屏最多用一块 plate;两块就是一个没有底色可言的页面。

在这里,高度和层叠是两个问题,而且只有第二个是真的。七个层级——从 1 的 --z-rule 到 300 的 --z-toast——说明谁压在谁上面,它们没有一个暗示阴影,因为根本没有阴影可投。一个表面的层级由它必须越过什么决定:抽屉要盖过吸顶的页头,遮罩要把这两者一起盖住,模态要压在自己的遮罩上,锚定面板要盖过把它打开的那个模态——对话框里放一个选择器是最寻常不过的形状,而层级排在模态之下,面板就会被画到召唤它的那个对话框背后——而提示条要在一个正在提问的模态之上仍然看得见。这条阶梯本身列在「空间与形状」那一页,不在这里重复。

七个里有两个在语义层有面向组件的别名:--z-dropdown 和 --z-overlay。从组件里去拿这两个;只有当你要摆放的东西这套系统没有名字时,才去拿原始层级。

接着读色彩空间与形状

深度

其中四个刻意什么都不画:--shadow-sm、--shadow 和 --shadow-lg 解析为 none,--shadow-color 解析为 transparent。--lift 和 --lift-sm 是取代那条阶梯的偏移——目前包里没有任何组件使用,它们是发布给使用者的,不是在这里被消费的。

深度 tokens
样例Token值暗色备注
--shadow-offsetvar(--clay)var(--clay)—
--shadow-colortransparent相同─── Depth ──────────────────────────────────────────────────────────── Law 2 — a box-shadow is never blurred. The system has no elevation ramp; depth is a hard offset in ink, applied per component. These three resolve to nothing on purpose, so a component ported from a shadowed system stays flat instead of drawing a blur the White Reset does not have. --lift below is the sanctioned offset idiom for anything that must read as raised.
--shadow-smnone相同—
--shadownone相同—
--shadow-lgnone相同—
--lift3px 3px 0 0 var(--shadow-offset)相同The one depth cue the system does have: a hard 3px ink offset, no blur, in the accent rather than a grey because --shadow-offset points at --clay. PUBLISHED, NOT CONSUMED. No component in this package sets either one — there is not a single shadow-(--lift) in src/. What the library actually separates with is a hairline, a change of ground, and the reversal that Card variant="plate" reaches for. These two exist so a consumer building a raised plate of their own has the system's answer instead of inventing a blur; do not read them as describing what the library does.
--lift-sm2px 2px 0 0 var(--shadow-offset)相同—
--disabled-opacity0.5相同—