Skip to content
中文

Shadow and layers

There are only three shadows, and all of them are faint. When white space and a change of background can separate the layers, don’t add a shadow.

--hao-shadow-card
Cards. Very light, like paper floating on a desk. At night a black shadow can’t be seen on a dark ground, so it adds a very faint light edge.
--hao-shadow-float
Overlays and raised menus. At night it adds the same light edge, so overlays have a boundary.
--hao-shadow-thumb
Switch thumbs and the selected block of segmented controls.

Stacking order

TokenValueUse
--hao-z-nav100Sticky navigation bars and fixed bottom tab bars.
--hao-z-sheet200Scrims and bottom sheets.
--hao-z-dialog300Dialogs.
--hao-z-popover350Menus and popovers. Higher than dialogs, so they remain visible when opened inside a dialog.
--hao-z-toast400Toasts; always on top.

Opacity

TokenValueUse
--hao-opacity-disabled0.4Disabled controls drop to this opacity as a whole.
--hao-opacity-pressed0.85The moment of pressing.

Motion

TokenValueUse
--hao-dur-fast120msPress, hover, and check.
--hao-dur-base200msSwitches, segmented sliders, and tab changes.
--hao-dur-slow320msDialogs, bottom sheets, and page transitions.
--hao-ease-outcubic-bezier(.2, .8, .2, 1)Enter: fast start, slow stop.
--hao-ease-in-outcubic-bezier(.4, 0, .2, 1)Position movement.