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).
Extends
Section titled “Extends”Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UIScrollView(
props):UIScrollView
Defined in: ui/src/UIScrollView.ts:156
Parameters
Section titled “Parameters”Returns
Section titled “Returns”UIScrollView
Overrides
Section titled “Overrides”Properties
Section titled “Properties”_transform
Section titled “_transform”
readonly_transform:ElementTransform
Defined in: ui/src/UIElementBase.ts:20
Internal
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”yogaNode
Section titled “yogaNode”
readonlyyogaNode:Node
Defined in: ui/src/UIScrollView.ts:98
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”Accessors
Section titled “Accessors”children
Section titled “children”Get Signature
Section titled “Get Signature”get children(): readonly
UIElement[]
Defined in: ui/src/UIScrollView.ts:253
Returns
Section titled “Returns”readonly UIElement[]
Implementation of
Section titled “Implementation of”displayObject
Section titled “displayObject”Get Signature
Section titled “Get Signature”get displayObject():
DisplayContainer
Defined in: ui/src/UIScrollView.ts:152
Returns
Section titled “Returns”DisplayContainer
Implementation of
Section titled “Implementation of”UIContainerElement.displayObject
Overrides
Section titled “Overrides”maxScroll
Section titled “maxScroll”Get Signature
Section titled “Get Signature”get maxScroll():
number
Defined in: ui/src/UIScrollView.ts:317
Maximum scrollable offset (content overflow), computed each layout.
Returns
Section titled “Returns”number
rotation
Section titled “rotation”Get Signature
Section titled “Get Signature”get rotation():
number
Defined in: ui/src/UIElementBase.ts:50
See LayoutProps.rotation.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set rotation(
value):void
Defined in: ui/src/UIElementBase.ts:54
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get scale():
Readonly<{x:number;y:number; }>
Defined in: ui/src/UIElementBase.ts:41
See LayoutProps.scale.
Returns
Section titled “Returns”Readonly<{ x: number; y: number; }>
Set Signature
Section titled “Set Signature”set scale(
value):void
Defined in: ui/src/UIElementBase.ts:45
Parameters
Section titled “Parameters”number | { x: number; y: number; }
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”scrollbarGutter
Section titled “scrollbarGutter”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
scrollOffset
Section titled “scrollOffset”Get Signature
Section titled “Get Signature”get scrollOffset():
number
Defined in: ui/src/UIScrollView.ts:312
Current scroll offset in pixels along the scroll axis.
Returns
Section titled “Returns”number
transformOrigin
Section titled “transformOrigin”Get Signature
Section titled “Get Signature”get transformOrigin():
Readonly<{x:number;y:number; }>
Defined in: ui/src/UIElementBase.ts:32
See LayoutProps.transformOrigin.
Returns
Section titled “Returns”Readonly<{ x: number; y: number; }>
Set Signature
Section titled “Set Signature”set transformOrigin(
value):void
Defined in: ui/src/UIElementBase.ts:36
Parameters
Section titled “Parameters”number | { x: number; y: number; }
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”viewportHeight
Section titled “viewportHeight”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
viewportWidth
Section titled “viewportWidth”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
visible
Section titled “visible”Get Signature
Section titled “Get Signature”get visible():
boolean
Defined in: ui/src/UIScrollView.ts:668
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set visible(
v):void
Defined in: ui/src/UIScrollView.ts:672
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”zIndex
Section titled “zIndex”Get Signature
Section titled “Get Signature”get zIndex():
number
Defined in: ui/src/UIElementBase.ts:59
See LayoutProps.zIndex.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set zIndex(
value):void
Defined in: ui/src/UIElementBase.ts:63
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”_attachToTree()
Section titled “_attachToTree()”_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.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”UIContainerElement._attachToTree
_detachFromTree()
Section titled “_detachFromTree()”_detachFromTree():
void
Defined in: ui/src/UIScrollView.ts:305
Internal
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”UIContainerElement._detachFromTree
_inspectState()
Section titled “_inspectState()”_inspectState():
object
Defined in: ui/src/UIScrollView.ts:747
Internal
Returns
Section titled “Returns”object
focusable
Section titled “focusable”focusable:
boolean
focused
Section titled “focused”focused:
boolean
addElement()
Section titled “addElement()”addElement(
child):void
Defined in: ui/src/UIScrollView.ts:257
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”applyLayout()
Section titled “applyLayout()”applyLayout():
void
Defined in: ui/src/UIScrollView.ts:465
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”UIContainerElement.applyLayout
applyTransformProps()
Section titled “applyTransformProps()”
protectedapplyTransformProps(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”UIElementBase.applyTransformProps
button()
Section titled “button()”button(
label,opts):UIButton
Defined in: ui/src/UIScrollView.ts:281
Add a button element.
Parameters
Section titled “Parameters”string
Omit<UIButtonProps, "children">
Returns
Section titled “Returns”destroy()
Section titled “destroy()”destroy():
void
Defined in: ui/src/UIScrollView.ts:752
Idempotent — a second call is a no-op.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”insertElementBefore()
Section titled “insertElementBefore()”insertElementBefore(
child,before):void
Defined in: ui/src/UIScrollView.ts:265
Parameters
Section titled “Parameters”before
Section titled “before”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”UIContainerElement.insertElementBefore
panel()
Section titled “panel()”panel(
opts?):UIPanel
Defined in: ui/src/UIScrollView.ts:286
Add a nested child panel.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”removeElement()
Section titled “removeElement()”removeElement(
child):void
Defined in: ui/src/UIScrollView.ts:261
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”UIContainerElement.removeElement
scrollBy()
Section titled “scrollBy()”scrollBy(
delta):void
Defined in: ui/src/UIScrollView.ts:362
Scroll by a relative delta (clamped). Positive = toward content end.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
scrollIntoView()
Section titled “scrollIntoView()”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.
Parameters
Section titled “Parameters”element
Section titled “element”Returns
Section titled “Returns”void
Throws
Section titled “Throws”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()
Section titled “scrollTo()”scrollTo(
offset):void
Defined in: ui/src/UIScrollView.ts:357
Scroll to an absolute offset (clamped).
Parameters
Section titled “Parameters”offset
Section titled “offset”number
Returns
Section titled “Returns”void
scrollView()
Section titled “scrollView()”scrollView(
opts?):UIScrollView
Defined in: ui/src/UIScrollView.ts:291
Add a nested scrollable viewport.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”UIScrollView
text()
Section titled “text()”text(
content,style?,opts?):UIText
Defined in: ui/src/UIScrollView.ts:272
Add a text element. See UIPanel.text for opts.
Parameters
Section titled “Parameters”content
Section titled “content”string
style?
Section titled “style?”Partial<TextStyleOptions>
Returns
Section titled “Returns”update()
Section titled “update()”update(
props):void
Defined in: ui/src/UIScrollView.ts:677
Parameters
Section titled “Parameters”Partial<UIScrollViewProps>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”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.