Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VScroller ¶
func VScroller(props VScrollerProps) *dom.Node
VScroller creates a vertical scrolling container that shows a sliding window of children starting from BeginIndex and fitting within the specified Height. It includes headers at the top and bottom indicating items outside the visible area. The SelectedIndex ensures the selected item is always visible.
Types ¶
type SliceVerticalResult ¶
type SliceVerticalResult struct {
BeginIndex int // The actual begin index (adjusted if out of bounds)
EndIndex int // The end index (exclusive) for slicing
ShowTopIndicator bool // Whether to show "items above" indicator
ShowBottomIndicator bool // Whether to show "items below" indicator
ItemsAbove int // Number of items above the visible range
ItemsBelow int // Number of items below the visible range
}
SliceVerticalResult contains the result of vertical slicing calculation
func SliceVertical ¶
func SliceVertical(nodes []*dom.Node, beginIndex int, selectedIndex int, height int) SliceVerticalResult
SliceVertical calculates which nodes fit within the given height, accounting for scroll indicators. It returns a struct with all the information needed to render the visible portion with indicators. The function automatically reserves space for top/bottom indicators when needed.
Parameters:
- nodes: The list of all nodes
- beginIndex: The starting index for the visible window (scroll position)
- selectedIndex: The currently selected item index (must be visible)
- height: The total available height
The function ensures both beginIndex and selectedIndex are visible, adjusting beginIndex if necessary.