Browse documentation

Scrolling

Keep oversized content navigable with a scroll view and optional scrollbar.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Scroll view

Choose vertical, horizontal, or both axes. Scrollbar modes are overlay, always, and hidden.

Rendered example
Scrollable table, tree, and charts in a data section.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::ScrollView.new(axis: :vertical, scrollbar: :overlay)
  .child(Zaniah::UI::Label.new("Long content"))

Programmatic scrolling

Call scroll_to on the view when content should be revealed after selection.

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
ScrollView(axis:, scrollbar:); scroll_tovertical/horizontal/both; overlay/always/hidden
Scrollbar(scroll_state, axis:, mode:)drag, track paging, arrows/Home/End/Page keys

Accessibility

The scrollbar supports dragging, track paging, arrows, Home, End, and Page keys.

ComponentSemantic role
ScrollViewchild tree
Scrollbarscrollbar