Elevation
Elevation says how far a surface sits above the page. Orvain UI uses 4 shadow levels, an edge colour that keeps raised surfaces visible in dark mode, and one order for layers to stack in. Every value below comes from @orvain/tokens 0.1.4, the same package the React and Vue components read.
Shadow levels#
Each level has a light and a dark value. In dark mode the shadows are deeper, because a dark ground swallows a soft one.
light
--orvain-shadow-lightResting surfaces that sit on the page. Cards, feed items, icon tiles, calendar cells.
soft
--orvain-shadow-softA control raised a step off its surface. Toggles, handles, a selected segment.
default
--orvain-shadow-defaultPanels that float over the page. Popovers, menus, dropdowns, dialogs.
hover
--orvain-shadow-hoverA surface lifted under the pointer. Card hover, a floating navbar.
Choosing a level#
Pick the level for what the surface does, not for how strong you want it to look. A surface that moves between states moves between levels: a card rests on light and lifts to hover under the pointer.
Edges in dark mode#
On a dark ground a shadow alone hardly separates a surface from the page. So raised surfaces also carry the edge colour: clear in light mode and a faint white hairline in dark. These are the elevation colours the components use:
edgeshadowshadow-blackhighlightThe package also has 7 drop colours (drop-ink-static, drop-slate3, drop-navy3, drop-navy6, shadow-slate, shadow-grey, glass). They are the building blocks of individual component shadows, and you will rarely need them directly.
Layer order#
Anything that floats needs a place in the stack. Use these steps rather than a number of your own, so a tooltip always lands above a dialog and a toast above both.
Using the tokens#
Shadows and colours work as they are in CSS. In JavaScript, use the exports for canvas or chart code where custom properties don't reach. The CSS layer is the one that switches with the theme.
Dark mode follows data-theme="dark" on any ancestor, or data-theme="system" to follow the reader's setting. The custom properties switch on their own. The JS and SCSS values are the light ones.
