Scrollbars
Overview
rs-grid renders its own scrollbars on the canvas instead of using native browser scrollbars. This ensures consistent appearance across platforms and integrates with the theme system.
Components
Both vertical and horizontal scrollbars share the same structure:
Interactions
Geometry
The scrollbar geometry is precomputed each frame:
Vertical (ScrollbarGeom)
Horizontal (HScrollbarGeom)
Same structure mirrored horizontally.
Visibility
Scrollbars are only shown when content overflows the viewport:
- Vertical: when
total_height > viewport_height - Horizontal: when
total_width > viewport_width
The minimum thumb size is 24px to ensure it remains grabbable.
Theming
Space reservation
The scrollbar width is reserved in layout:
model.scrollbar_size(default: 14px) is subtracted from available space to prevent content from being obscured