SpreadsheetGrid
Guides

Scroll position indicator

A bubble / ruler / jump preview that shows "which row you're on" while scrolling through many rows

With many rows (especially around 1 million), moving the scrollbar by 1px equals hundreds or thousands of rows, and it's easy to lose track of where you are while moving. Turn on scrollHint, and the following overlays answer that (an opt-in feature that is completely off by default).

  • Custom scrollbar: draws an always visible track and a thumb of at least 30px in a dedicated gutter starting below the header (supports dragging, click-to-jump and the wheel). It replaces macOS overlay scrollbars, which disappear on their own and whose thumb becomes tiny with many rows, losing "the place to grab".
  • Row number bubble: while scrolling, shows "Row N / total rows" next to the thumb. You can add any column value (a part number and so on) too.
  • Row ruler: fades in a row-count scale on the right edge of the body (round steps).
  • Jump preview: putting the pointer on the scrollbar shows a dotted line + label for "jumping here goes to row N" (the same mapping as clicking / dragging the scrollbar).

Demo (100,000 rows)

100,000 rows — drag the scrollbar or hover the right edge
Rows 100000 of 100000Columns 6 of 6Sort: —
#
ID
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
12
13
13
14
14
15
15
16
16
17
17
18
18
19
19
20
20
21
21
Rows 100000 of 100000Columns 6 of 6
Cell —Range —0 cells / 0 rows0 columns
  • Drag the scrollbar thumb, and the bubble follows the current first row.
  • Put the pointer on the right edge (the scrollbar strip), and the ruler and the jump preview appear.
  • Switch "Content" to compare the 3 forms: row number only / hintColumn / renderHint.

Turning it on

// everything (bubble + ruler, trigger='scroll')
<SpreadsheetGrid scrollHint />

// individual settings
<SpreadsheetGrid
  scrollHint={{
    bubble: true,       // row number bubble (default true)
    ruler: true,        // ruler + jump preview (default true)
    scrollbar: true,    // custom vertical scrollbar (default true; false keeps the native bar)
    trigger: 'scroll',  // 'scroll' (default) | 'hover' | 'always'
    minRows: 0,         // data size gate (default 0 = always on; details below)
  }}
/>

trigger: 'scroll' shows it only while scrolling, and fades out about 1 second after stopping. Nothing changes in the look while stopped.

Automatic on / off by data size (minRows)

With small data of a few dozen rows, the bubble / ruler / custom scrollbar tend to be noise. With minRows, scrollHint is on only when the number of visible rows is at or above the threshold.

// show the scroll hint only with 100 rows or more (the native scrollbar below that)
<SpreadsheetGrid scrollHint={{ hintColumn: 'code', minRows: 100 }} />
  • The row count used is the same as "/ total rows" in the bubble: the number of view rows after filtering / grouping (the server's total for SSRM). Filtering below the threshold turns it off automatically for that time.
  • The default is 0 (always on), so behavior doesn't change unless you set it.
  • Note: with scrollbar on, the gutter space is added and removed when crossing the threshold, so screens where the row count changes see a slight layout shift (if that bothers you, use it with scrollbar: false).

Customizing the content

To add any column value to the row number, use hintColumn (simple) or renderHint (fully custom; wins over hintColumn).

// simple: row number + item code
<SpreadsheetGrid scrollHint={{ hintColumn: 'code' }} />

// fully custom: code — item name
<SpreadsheetGrid
  scrollHint={{
    renderHint: ({ rowIndex, rowData }) =>
      rowData ? `${rowData.code} — ${rowData.name}` : null,
  }}
/>

When renderHint returns null / undefined, the default display with only the row number is used.

Behavior with SSRM / grouping

When the row targeted by the bubble / preview is an unloaded SSRM row (or a group row with grouping), rowData is undefined, and with hintColumn it automatically falls back to the row number only (renderHint receives undefined as is, so branch on your side).

The indicator itself is driven only by "total rows + scroll position", so it works as is in every setup, including clientSide / SSRM / auto-height.

How it works and notes

  • Row numbers are resolved with the same mapping as the virtualization's vertical geometry (pixel scaling for 1 million rows / prefix sums for auto-height), so they always match what's on screen.
  • The bubble / ruler / preview overlays have pointer-events: none and don't interfere with scrolling or cell operations at all. Only the custom scrollbar's gutter takes pointer input, but scrolling the contents stays native (the gutter is a mirror that only writes scrollTop).
  • With the custom scrollbar on, the native vertical scrollbar is hidden (Chromium / WebKit; in Firefox the native vertical bar remains, but the gutter works). The horizontal scrollbar is styled with the same colors through tokens.
  • When every row fits in the viewport and it can't scroll, nothing is shown.
  • Colors of the bubble / thumb / labels follow the theme tokens (--ssg-pill-* / --ssg-scrollhint-*) and work in both light and dark themes.

For all options, see SpreadsheetGrid props.

On this page