Flex-grid

A pooled, virtualized 2D grid for RSG TypeScript apps, for the rows of cards, shelves and poster grids that show many items at once

Cells come from a recycled pool and only the rows near the viewport exist, so a grid with hundreds of items stays within what a device can hold. You describe the geometry and the cell component, choose a focus strategy for each axis, and add optional plugins such as row titles, a focus highlight or zoom-on-focus. The grid owns scrolling and focus movement inside itself.

Pages

PageDescription
_resetGlobalHooksForTestReset global hook installation state.
binarySearchFloorFinds the last sorted position that does not exceed a target.
buildCumYBuilds cumulative vertical positions for rows with different heights.
buildUniformCumXBuilds cumulative horizontal positions for equally sized items.
buildVariableCumXBuilds cumulative horizontal positions for items with different widths.
clearDirtyCalled by the engine after it has processed all dirty rows in a tick.
composeHorizontalStrategyCompose a base horizontal strategy with zero or more row-specific extensions.
computeBobRowReserveComputes the extra row spacing reserved by the bob plugin.
computeBobYComputes the vertical position below a row for the bob plugin.
computeDataRowDetermine the data row index displayed in a given vertical pool slot, given the focused row and pool window parameters.
computeEndZoneStartRowFinds the first row in the fixed-focus end zone.
computeScrollYForRowComputes the vertical translation that pins a row at the fixed focus line.
computeTotalContentHeightComputes the content height without a trailing row gap.
computeUniformPoolSizeCompute pool dimensions for a uniform grid (all cells share one cellSize).
computeVariablePoolSizeCompute pool dimensions for a variable-geometry grid (rows may differ in cell size).
computeVirtualXComputes a horizontal position for a column in a looping row.
createBobPluginCreate a bob-in-the-middle plugin.
createDirectionalPinnedFocusXExtensionPins the focused item's left edge to the X coordinate selected by getAlign.
createEmptyPlaceholderPluginCreate an empty/loading placeholder plugin.
createFlexGridcreateFlexGrid — description pending.
createFlexGridEngineCreates the low-level layout engine for a grid.
createFocusHighlightPluginCreate a focus-highlight plugin.
createGridStoreCreate a new GridStore with numRows rows, all initially undefined (loading).
createNavigationControllerCreates the low-level grid navigation controller.
createPerfPluginCreates grid performance instrumentation for console output or reactive counters.
createPinnedFocusXExtensionPin the focused item's left edge to a fixed screen X (hero banner carousel).
createPoolcreatePool — description pending.
createRowBackdropPluginOne backdrop node per region in the grid's back scroll layer: behind every row, scrolling with them, and gliding with the rows when a row Y offset opens above or inside it.
createRowCardsClipPluginClips a row's cards to a rect that moves with the row but not with its horizontal scroll, so the cards scroll through it and a card is cut at its edge with its motion untouched.
createRowTitlePluginCreate a row-title plugin.
createScrollXOffsetExtensionSubtracts an offset from the base strategy's scroll X for matching focus states.
createSmoothScrollBridgePluginMakes scroll state available to cell templates through their grid key.
defineFlexGridReturns a Solid component that renders a grid configured through FlexGridRuntimeProps.
findNearestSortedIndexFinds the sorted position nearest to a target within a prefix.
fixedFocusStrategyfixedFocusStrategy — description pending.
fixedFocusWrapStrategyfixedFocusWrapStrategy — description pending.
floatingFocusStrategyfloatingFocusStrategy — description pending.
floatingFocusYStrategyfloatingFocusYStrategy — description pending.
gridScrollMsReads the grid's current per-step scroll duration in milliseconds.
isGridSmoothScrollingReads whether a grid is currently performing a held smooth scroll.
isPerfGridPluginIdentifies performance plugins during grid initialization.
matchRowMatches a single row index.
matchRowWhenMatches when a predicate on the row index returns true.
resolveFocusConfigResolves focus options for the grid implementation.
resolveGridPluginsResolves plugin entries during grid initialization.
setNumRowsGrow or shrink the store's row count.
setRowUpdate a single row in place.
setRowsUpdate multiple contiguous rows in place.
withZoomFocusReturns a cell template that scales on focus via the grid tween primitive.
Flex-grid typesTypes shared by several @roku-sdk/flex-grid exports.

Did this page help you?