Skip to content

UIScrollView

Defined in: ui/src/UIScrollView.ts:97

A clipped, scrollable viewport that owns a normal Yoga child subtree.

Unlike the imperative @pixi/ui wrappers, this is a true UIContainerElement: children are first-class Yoga nodes laid out by the existing layout pass, so it works identically via the React reconciler (<ScrollView>), the UIPanel builder (.scrollView()), or direct addElement. Content overflowing the viewport on the scroll axis is clipped by a mask and panned by a wheel/drag-driven offset that survives re-renders (the node instance is stable; only children are diffed).

new UIScrollView(props): UIScrollView

Defined in: ui/src/UIScrollView.ts:156

UIScrollViewProps

UIScrollView

UIElementBase.constructor

readonly _transform: ElementTransform

Defined in: ui/src/UIElementBase.ts:20

Internal

UIContainerElement._transform

UIElementBase._transform


readonly yogaNode: Node

Defined in: ui/src/UIScrollView.ts:98

UIContainerElement.yogaNode

UIElementBase.yogaNode

get children(): readonly UIElement[]

Defined in: ui/src/UIScrollView.ts:253

readonly UIElement[]

UIContainerElement.children


get displayObject(): DisplayContainer

Defined in: ui/src/UIScrollView.ts:152

DisplayContainer

UIContainerElement.displayObject

UIElementBase.displayObject


get maxScroll(): number

Defined in: ui/src/UIScrollView.ts:317

Maximum scrollable offset (content overflow), computed each layout.

number


get rotation(): number

Defined in: ui/src/UIElementBase.ts:50

See LayoutProps.rotation.

number

set rotation(value): void

Defined in: ui/src/UIElementBase.ts:54

number

void

UIElementBase.rotation


get scale(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:41

See LayoutProps.scale.

Readonly<{ x: number; y: number; }>

set scale(value): void

Defined in: ui/src/UIElementBase.ts:45

number | { x: number; y: number; }

void

UIElementBase.scale


get scrollbarGutter(): number

Defined in: ui/src/UIScrollView.ts:341

Px reserved on the scroll-cross edge for the scrollbar so content never renders under the thumb. 0 when the scrollbar is hidden.

number


get scrollOffset(): number

Defined in: ui/src/UIScrollView.ts:312

Current scroll offset in pixels along the scroll axis.

number


get transformOrigin(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:32

See LayoutProps.transformOrigin.

Readonly<{ x: number; y: number; }>

set transformOrigin(value): void

Defined in: ui/src/UIElementBase.ts:36

number | { x: number; y: number; }

void

UIElementBase.transformOrigin


get viewportHeight(): number

Defined in: ui/src/UIScrollView.ts:333

Height of the clipped viewport in px, scrollbar gutter included. 0 before the first layout pass.

number


get viewportWidth(): number

Defined in: ui/src/UIScrollView.ts:325

Width of the clipped viewport in px, scrollbar gutter included. 0 before the first layout pass.

number


get visible(): boolean

Defined in: ui/src/UIScrollView.ts:668

boolean

set visible(v): void

Defined in: ui/src/UIScrollView.ts:672

boolean

void

UIContainerElement.visible

UIElementBase.visible


get zIndex(): number

Defined in: ui/src/UIElementBase.ts:59

See LayoutProps.zIndex.

number

set zIndex(value): void

Defined in: ui/src/UIElementBase.ts:63

number

void

UIElementBase.zIndex

_attachToTree(context): void

Defined in: ui/src/UIScrollView.ts:300

Internal

Take the context of the UI tree this viewport belongs to. The content panel holds the children, so it holds the context.

UITreeContext

void

UIContainerElement._attachToTree


_detachFromTree(): void

Defined in: ui/src/UIScrollView.ts:305

Internal

void

UIContainerElement._detachFromTree


_inspectState(): object

Defined in: ui/src/UIScrollView.ts:747

Internal

object

focusable: boolean

focused: boolean


addElement(child): void

Defined in: ui/src/UIScrollView.ts:257

UIElement

void

UIContainerElement.addElement


applyLayout(): void

Defined in: ui/src/UIScrollView.ts:465

void

UIContainerElement.applyLayout


protected applyTransformProps(props): void

Defined in: ui/src/UIElementBase.ts:27

Apply the four transform props present in props. A present key holding undefined resets that prop to its default. Throws before writing anything if a value is not finite.

LayoutProps

void

UIElementBase.applyTransformProps


button(label, opts): UIButton

Defined in: ui/src/UIScrollView.ts:281

Add a button element.

string

Omit<UIButtonProps, "children">

UIButton


destroy(): void

Defined in: ui/src/UIScrollView.ts:752

Idempotent — a second call is a no-op.

void

UIContainerElement.destroy

UIElementBase.destroy


insertElementBefore(child, before): void

Defined in: ui/src/UIScrollView.ts:265

UIElement

UIElement

void

UIContainerElement.insertElementBefore


panel(opts?): UIPanel

Defined in: ui/src/UIScrollView.ts:286

Add a nested child panel.

UIPanelProps

UIPanel


removeElement(child): void

Defined in: ui/src/UIScrollView.ts:261

UIElement

void

UIContainerElement.removeElement


scrollBy(delta): void

Defined in: ui/src/UIScrollView.ts:362

Scroll by a relative delta (clamped). Positive = toward content end.

number

void


scrollIntoView(element, opts?): void

Defined in: ui/src/UIScrollView.ts:382

Scroll the least distance that brings element inside the viewport on this view’s scroll axis. align defaults to "nearest", which does not move an element that is already fully visible, so onScroll does not fire.

padding is px kept between the element and the viewport edge it is aligned against; it does not apply to align: "center".

Before the first layout pass the call does nothing and a development warning names the view.

UIElement

UIScrollIntoViewOptions

void

when element is not inside this view, or padding is not a finite number of pixels at or above zero. Both throw before the offset moves.


scrollTo(offset): void

Defined in: ui/src/UIScrollView.ts:357

Scroll to an absolute offset (clamped).

number

void


scrollView(opts?): UIScrollView

Defined in: ui/src/UIScrollView.ts:291

Add a nested scrollable viewport.

UIScrollViewProps

UIScrollView


text(content, style?, opts?): UIText

Defined in: ui/src/UIScrollView.ts:272

Add a text element. See UIPanel.text for opts.

string

Partial<TextStyleOptions>

UITextBuilderProps

UIText


update(props): void

Defined in: ui/src/UIScrollView.ts:677

Partial<UIScrollViewProps>

void

UIContainerElement.update

UIElementBase.update

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/ui.md.