MCPcopy Create free account
hub / github.com/bvaughn/react-window / GridImperativeAPI

Interface GridImperativeAPI

lib/components/grid/types.ts:353–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351 * ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience in TypeScript projects.
352 */
353export interface GridImperativeAPI {
354 /**
355 * Outermost HTML element for the grid if mounted and null if not mounted.
356 */
357 get element(): HTMLDivElement | null;
358
359 /**
360 * Scrolls the grid so that the specified row and column are visible.
361 * Like the browser's `scrollIntoView`, items are aligned within the CSS `scroll-padding` of the element being scrolled
362 * (e.g. `scroll-padding-top` can leave room for a sticky header).
363 *
364 * @param behavior Determines whether scrolling is instant or animates smoothly
365 * @param columnAlign Determines the horizontal alignment of the element within the grid
366 * @param columnIndex Index of the column to scroll to (0-based)
367 * @param rowAlign Determines the vertical alignment of the element within the grid
368 * @param rowIndex Index of the row to scroll to (0-based)
369 *
370 * @throws RangeError if an invalid row or column index is provided
371 */
372 scrollToCell: ({
373 behavior,
374 columnAlign,
375 columnIndex,
376 rowAlign,
377 rowIndex
378 }: {
379 behavior?: "auto" | "instant" | "smooth";
380 columnAlign?: "auto" | "center" | "end" | "smart" | "start";
381 columnIndex: number;
382 rowAlign?: "auto" | "center" | "end" | "smart" | "start";
383 rowIndex: number;
384 }) => void;
385
386 /**
387 * Scrolls the grid so that the specified column is visible.
388 * Like the browser's `scrollIntoView`, items are aligned within the CSS `scroll-padding` of the element being scrolled
389 * (e.g. `scroll-padding-top` can leave room for a sticky header).
390 *
391 * @param align Determines the horizontal alignment of the element within the grid
392 * @param behavior Determines whether scrolling is instant or animates smoothly
393 * @param index Index of the column to scroll to (0-based)
394 *
395 * @throws RangeError if an invalid column index is provided
396 */
397 scrollToColumn: ({
398 align,
399 behavior,
400 index
401 }: {
402 align?: "auto" | "center" | "end" | "smart" | "start";
403 behavior?: "auto" | "instant" | "smooth";
404 index: number;
405 }) => void;
406
407 /**
408 * Scrolls the grid so that the specified row is visible.
409 * Like the browser's `scrollIntoView`, items are aligned within the CSS `scroll-padding` of the element being scrolled
410 * (e.g. `scroll-padding-top` can leave room for a sticky header).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected