sdxc

Type to search, or start from one of these:

layout

anchor

Resolves an anchor() reference to a plain string — the length an inset utility needs to pin an edge to the anchor's geometry.

import { anchor } from "@sdxc/u/layout";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.insBs(u.anchor("tip", "bottom"))"anchor(--tip bottom)"
u.anchor("menu-button", "self-end")"anchor(--menu-button self-end)"
u.anchor("tip", "bottom", "100%")"anchor(--tip bottom, 100%)"
u.anchor("sidebar", "center", "0px")"anchor(--sidebar center, 0px)"

Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

u.insBs(u.anchor("tip", "bottom"))

Applying on a state

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

u.hover(u.insBs(u.anchor("tip", "bottom")))

Responsive design

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

u.at("md", u.insBs(u.anchor("tip", "bottom")))

Signature

u.anchor(name: string, side: AnchorSide, fallback?: string)