A surface philosophy — eight elevation levels that nest. Components read their substrate from context and lift relative to it, so popovers, dropdowns and dialogs stay visible at any depth, in both light and dark mode.
Eight levels, each one step above its substrate.
On the page
Menu
Inside a dialog
Menu
The same popover stays visible three layers down.
In light mode, we use shadow behind white surfaces to signify elevation. In dark mode, we use progressively lighter backgrounds instead.
But traditional components have a fixed background — a dropdown often ends up the same color as the dialog it sits in, and disappears into it.
Three pieces: tokens, substrate context and the primitive.
bg/shadow pairs. Light mode flattens to white after
step 2 (shadow alone carries elevation). Dark mode keeps adding white-opacity
plus a layered shadow recipe.pnpm dlx shadcn@latest add https://matos-ui.com/r/elevated.jsonThe CLI copies the primitive, the substrate context and the class helpers, and
adds the surface tokens to your globals.css.
import { Elevated } from '@/components/matos-ui/elevated'
import { SurfaceProvider } from '@/lib/surface-context'Set a base substrate, then let each panel lift itself relative to it. The
offset is what a component adds to whatever it is nested inside — so the same
Elevated reads correctly on the page or several layers deep.
<SurfaceProvider value={1}>
<div className="rounded-2xl bg-surface-1 shadow-surface-1 p-4">
{/* Dialog: 1 + 4 = surface-5 */}
<Elevated offset={4} className="rounded-2xl p-4">
{/* Popover inside the dialog: 5 + 2 = surface-7,
but a constant popover shadow regardless of depth */}
<Elevated offset={2} shadowLevel={3} className="rounded-xl p-2">
Menu
</Elevated>
</Elevated>
</div>
</SurfaceProvider>Conventional offsets: 2 for a dropdown / popover / select menu, 4 for a
dialog / modal.
ElevatedRenders a div whose background tracks the substrate and re-provides the new
level to its descendants. Accepts all native div props.
| Prop | Type | Default | Description |
|---|---|---|---|
offset | number | — | Steps above the current substrate. Final level is min(substrate + offset, 8). |
shadowLevel | number | computed level | Pins the shadow weight, e.g. a popover that keeps one shadow at any depth. |
SurfaceProviderSets the substrate level for everything inside. Clamped to 1–8.
| Prop | Type | Description |
|---|---|---|
value | number | The substrate level (1–8). |
useSurfaceuseSurface(): number — reads the current substrate level from context.
Install Matos UI
Choose a package manager and copy one command for every component.