Elevation
The three shadow levels of NachUI in light and dark mode, when to use each one, and why cards stay flat.
Elevation tells the reader what is sitting above what. NachUI keeps it to three levels, defined as tokens in both modes and mapped to
shadow-sm, shadow-md and shadow-lg. Anything else, like shadow-xl, shadow-2xl or an arbitrary shadow, is off the table.The three levels
Rendered with the values from the token files, on the real background, card and popover colors of each mode.
Light
Cardno shadow
shadow-smTab pill, switch thumb
shadow-mdPopover, menus, toast
shadow-lgDialog, sheet, drawer
Dark
Cardno shadow
shadow-smTab pill, switch thumb
shadow-mdPopover, menus, toast
shadow-lgDialog, sheet, drawer
| Utility | Use |
|---|---|
shadow-sm | Inline controls that sit slightly above their track, like the active tab pill or a switch thumb |
shadow-md | Anchored floating surfaces: popover, hover card, dropdown and context menu, select, toast |
shadow-lg | Modal surfaces: dialog, sheet, drawer |
The rule of thumb: the further something is from the page, and the more it blocks, the bigger its shadow. Something anchored to a trigger gets
md; something that takes over the screen gets lg.Values
--elevation-sm
Light 0 1px 3px oklch(25% 0.01 75 / 0.1)
Dark 0 1px 3px oklch(0% 0 0 / 0.45)
--elevation-md
Light 0 6px 20px -6px oklch(25% 0.01 75 / 0.13)
Dark 0 8px 24px -6px oklch(0% 0 0 / 0.55)
--elevation-lg
Light 0 16px 40px -12px oklch(25% 0.01 75 / 0.16)
Dark 0 16px 44px -12px oklch(0% 0 0 / 0.65)
Light mode shadows are tinted with the same warm hue as the neutrals and stay soft. Dark mode shadows are pure black and much stronger.
Cards stay flat
Cards and other containers that sit in the flow of the page have no shadow. They are separated by
bg-card and a border, which is enough on a calm page and keeps shadows meaningful: if something casts one, it is floating.Dark mode
On a dark page a shadow alone is hard to see, so dark mode lifts a surface in two ways at once: a lighter fill and a stronger shadow. The surfaces step up in lightness as they rise (background 14.5%, surface muted 18.2%, card 21.8%, popover 23.9%), which is why every floating surface must use
bg-popover. A menu painted with bg-background would have the same color as the page under it and lose its edge.Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.