# toVirtualScrollTop

> _Since v2.13.0_

Translate a native `scrollTop` (spacer space) into a virtual scroll offset
in raw row-content space. Identity when the mapping is not capped.

The result is clamped to `[0, rawContentHeight - viewportHeight]` so callers
never index past the dataset, even when the spacer's actual scrollable extent
slightly exceeds `spacerHeight - viewportHeight` (e.g. when a horizontal scrollbar
adds bottom padding to the faux spacer).

```ts
function toVirtualScrollTop(scrollTop: number, mapping: ScrollMapping): number
```

## Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| `scrollTop` | <code>number</code> |  |
| `mapping` | <code><a href="/grid/api/plugin-development/interfaces/scrollmapping/">ScrollMapping</a></code> |  |
