ScrollView-class: ScrollView widget

ScrollViewR Documentation

ScrollView widget

Description

A container whose content can be larger than the widget. See scroll_view().

Super class

Widget -> ScrollView

Public fields

focusable

Scroll views can take focus so they can be scrolled with the keyboard even without focusable children.

direction

"vertical", "horizontal" or "both".

scrollbars

Draw scroll bars when the content overflows?

Active bindings

offset_x, offset_y

Scroll offsets in cells (reactive).

viewport

The visible content rectangle (after the last layout).

virtual_size

Size of the scrollable content: c(width, height).

max_scroll

Largest offsets: c(x, y).

Methods

Public methods

Inherited methods

ScrollView$new()

Create a scroll view. See scroll_view().

Usage
ScrollView$new(
  ...,
  direction = "vertical",
  scrollbars = TRUE,
  focusable = TRUE,
  id = NULL,
  classes = NULL,
  style = NULL,
  disabled = FALSE
)
Arguments
...

Child widgets.

direction

Scroll direction.

scrollbars

Show scroll bars?

focusable

Can the scroll view itself be focused?

id, classes, style, disabled

See Widget.


ScrollView$default_style()

The built-in style.

Usage
ScrollView$default_style()

ScrollView$default_bindings()

Arrow keys, Page Up/Down and Home/End scroll.

Usage
ScrollView$default_bindings()

ScrollView$scroll_to()

Scroll to an absolute position (in cells). Positions are clamped to the scrollable range at the next layout.

Usage
ScrollView$scroll_to(x = NULL, y = NULL)
Arguments
x, y

New offsets; NULL keeps the current one.


ScrollView$scroll_by()

Scroll relative to the current position.

Usage
ScrollView$scroll_by(dx = 0L, dy = 0L)
Arguments
dx, dy

Cells to scroll (negative: up/left).


ScrollView$scroll_home()

Scroll to the top (and left).

Usage
ScrollView$scroll_home()

ScrollView$scroll_end()

Scroll to the bottom.

Usage
ScrollView$scroll_end()

ScrollView$scroll_into_view()

Scroll so that a descendant is fully visible (as far as possible). Uses the last layout; the app re-lays out afterwards.

Usage
ScrollView$scroll_into_view(widget)
Arguments
widget

A descendant widget.

Returns

TRUE if the offsets changed.


ScrollView$on_mouse_scroll()

The mouse wheel scrolls by three lines. When the view cannot scroll further, the event bubbles to outer scroll views.

Usage
ScrollView$on_mouse_scroll(event)
Arguments
event

A MouseEvent.


ScrollView$action_scroll_up()

Scroll one line up.

Usage
ScrollView$action_scroll_up()

ScrollView$action_scroll_down()

Scroll one line down.

Usage
ScrollView$action_scroll_down()

ScrollView$action_scroll_left()

Scroll one column left.

Usage
ScrollView$action_scroll_left()

ScrollView$action_scroll_right()

Scroll one column right.

Usage
ScrollView$action_scroll_right()

ScrollView$action_page_up()

Scroll one page up.

Usage
ScrollView$action_page_up()

ScrollView$action_page_down()

Scroll one page down.

Usage
ScrollView$action_page_down()

ScrollView$action_scroll_home()

Scroll to the top.

Usage
ScrollView$action_scroll_home()

ScrollView$action_scroll_end()

Scroll to the bottom.

Usage
ScrollView$action_scroll_end()

ScrollView$arrange_children()

Lay the children out in a virtual area, shifted by the scroll offsets; reserves space for scroll bars when needed.

Usage
ScrollView$arrange_children(children, inner, st)
Arguments
children

Visible children.

inner

Content rectangle.

st

Computed style.


ScrollView$layout_descend()

Children entirely outside the viewport are not laid out in detail (unless a complete layout is needed, e.g. to scroll a focused widget into view).

Usage
ScrollView$layout_descend(rects)
Arguments
rects

Child rectangles.


ScrollView$child_clip()

Children are clipped to the viewport.

Usage
ScrollView$child_clip(st)
Arguments
st

Computed style.


ScrollView$paint()

Paint background, border and scroll bars.

Usage
ScrollView$paint(buffer, area, st)
Arguments
buffer

A ScreenBuffer.

area

Visible part of the region.

st

Computed style.


ScrollView$clone()

The objects of this class are cloneable with this method.

Usage
ScrollView$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


termr documentation built on Oct. 21, 2026, 5:13 p.m.