Skip to content

captureElement

captureElement(roots, options): object

Defined in: packages/xray/src/core.ts:63

Capture a live DOM subtree straight to the two renderable artifacts: the structural plate (tree, lowered to chunks) and its scoped css string — independent parts, per the two-artifact contract. Runs the same uniform pipeline the dev client does for a single View — measure (captureView), distil (distilPlate), project (serializePlateIR → the structured StoredPlate), then lower to chunks (serializePlate) — in one call. roots are the top-level elements to capture (a component’s rendered roots). Render however suits: renderPlateHtml(plate, composeCss(css)), or <Skeleton plate={plate} css={composeCss(css)}> with the React adapter.

options.walker is the public programmable capture walker (ADR 0018): the same XrayCaptureWalker the <Skeleton captureWalker> prop threads through in dev, available here for driving capture directly. It is capture-only and never persisted into the returned artifacts.

readonly Element[]

CaptureOptions

object

css: string

plate: Plate