SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

isolation

Creates a new stacking context on the host element while preserving its layout, so a later z-index on this element (or a descendant) stays confined here, isolated from unrelated siblings outside it.

tsx
import { isolate } from "@sdxc/u/stacking";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.isolate()css({ isolation: "isolate" })

Examples

Basic example

Use isolate() to start a new stacking context, so a negative z() inside stays above the element's own background:

without isolate()

isolate()

tsx
<div mix={[...]}>
	<div mix={[relative(), ...]}>
		<div mix={[absolute(), inset(4), z(-1), blur("lg"), bg("brand.solid")]} />
		<p mix={[...]}>without isolate()</p>
	</div>
	<div mix={[relative(), isolate(), ...]}>
		<div mix={[absolute(), inset(4), z(-1), blur("lg"), bg("brand.solid")]} />
		<p mix={[...]}>isolate()</p>
	</div>
</div>

Applying on a state

Wrap the call in a state utility to scope it to one selector.

typescript
u.hover(u.isolate())

Responsive design

Wrap the call in a container query to scope it to one width.

typescript
u.at("md", u.isolate())

Signature

typescript
u.isolate()
@sdxc/u

Can’t find it? Contact us