Components
Scroll Container
The Scroll Container Component.
The scroll container component creates a scrollable area for its child components. It supports vertical and horizontal scrolling, customizable scrollbars, and various sizing and alignment options.
Parameters
direction
vertical | horizontal required
The direction of the scroll container.
scrollbar-thiccness
int
The thickness of the scrollbar in pixels.
fixed-scrollbar-length
int
The fixed length of the scrollbar in pixels.
scrollbar-color
red | yellow | blue | green | gray | purple | ...
The color of the scrollbar.
scrollbar
The scrollbar renderer to use for custom scrollbar styles.
gap
int
The gap between child components in pixels.
padding
int | (int,int,int,int)
The padding around the child components.
surface
#hex
The background surface of the scroll container.
horizontal-alignment
left | right | center
The horizontal alignment of the child components.
vertical-alignment
top | middle | bottom
The vertical alignment of the child components.
allow-overflow
boolean
Whether to allow child components to overflow the bounds of the scroll container.
Examples
Containers.verticalScroll(Sizing.fill(100), Sizing.content())
.child(Components.label(Text.literal("Item 1")))
.child(Components.label(Text.literal("Item 2")))
.child(Components.label(Text.literal("Item 3")))
.scrollbarThiccness(10)
.scrollbarColor(0xff0000)
.padding(Insets.of(10))
.surface(Surface.PANEL)
<scroll direction="vertical">
<children>
<label>
<text>Item 1</text>
</label>
<label>
<text>Item 2</text>
</label>
<label>
<text>Item 3</text>
</label>
</children>
<scrollbar-thiccness>10</scrollbar-thiccness>
<scrollbar-color>#ff0000</scrollbar-color>
<padding>
<all>10</all>
</padding>
<surface>
<panel/>
</surface>
</scroll>