Documentation
    Preparing search index...

    Interface WidgetSkin

    The application-supplied visuals of one widget — the seam described at the top of this module.

    Every hook is optional, and every hook is called with the widget itself: a skin reads whatever it needs off the widget (size, state, text layout) and owns whatever it builds. A skin is free to add child nodes to the widget, to draw into an entirely separate subtree, or to do nothing at all.

    const skin: WidgetSkin = {
    onAttach(widget) { quad = new Renderable(planeGeometry(…), material); widget.add(quad); },
    onLayout(widget) { quad.transform.scale.set(widget.measuredWidth, widget.measuredHeight, 1); },
    onStateChange(widget) { material.color = widget.pressed ? PRESSED : widget.hovered ? HOVER : IDLE; },
    onDetach(widget) { widget.remove(quad); quad.dispose(); },
    };

    Ordering guarantees: onAttach runs before the first onLayout/ onStateChange of that skin (assigning a skin to an already laid-out widget calls all three immediately, so a late skin is never stale), and onDetach runs before the widget forgets the skin.

    interface WidgetSkin {
        onAttach?(widget: UIWidget): void;
        onContentChange?(widget: UIWidget): void;
        onDetach?(widget: UIWidget): void;
        onLayout?(widget: UIWidget): void;
        onStateChange?(widget: UIWidget): void;
    }
    Index
    • The skin was assigned to widget.

      Parameters

      Returns void

    • Content the skin draws changed without a layout or a state transition (2026-08-07, A-12): a Slider's or ProgressIndicator's value, a ProgressIndicator's indeterminate flag, an ImageWidget's source or natural size.

      A fourth hook rather than an overloaded onStateChange because these are not §75 states — a mirror must not announce a dragged slider as having changed its hover or focus — and not onLayout because the widget's box is exactly what did not move. A skin that draws only backgrounds ignores it, which is why it is optional like the rest.

      Parameters

      Returns void

    • The skin was replaced or the widget disposed.

      Parameters

      Returns void

    • widget's resolved size or position changed (§74).

      Parameters

      Returns void

    • widget's interaction state changed (§72) — any of the flags in WidgetStateSnapshot, including a checkable control's checked.

      Parameters

      Returns void