Skip to main content

Interface: FlatScrollIntoViewLocation

Hierarchy

Properties

align

Optional align: "start" | "center" | "end"

Inherited from

ScrollIntoViewLocationOptions.align

Defined in

dist/index.d.ts:354


behavior

Optional behavior: "auto" | "smooth"

Inherited from

ScrollIntoViewLocationOptions.behavior

Defined in

dist/index.d.ts:355


calculateViewLocation

Optional calculateViewLocation: CalculateViewLocation

Use this function to fine-tune the scrollIntoView behavior. The function receives the item's top and bottom position in the viewport, and the viewport top/bottom. Return an location object to scroll, or null to prevent scrolling. Here's the default implementation:

const defaultCalculateViewLocation: CalculateViewLocation = ({
itemTop,
itemBottom,
viewportTop,
viewportBottom,
locationParams: { behavior, align, ...rest },
}) => {
if (itemTop < viewportTop) {
return { ...rest, behavior, align: align ?? 'start' }
}
if (itemBottom > viewportBottom) {
return { ...rest, behavior, align: align ?? 'end' }
}
return null
}
Read-only

Inherited from

ScrollIntoViewLocationOptions.calculateViewLocation

Defined in

dist/index.d.ts:383


done

Optional done: () => void

Type declaration

▸ (): void

Will be called when the scroll is done, or immediately if no scroll is needed.

Returns

void

Inherited from

ScrollIntoViewLocationOptions.done

Defined in

dist/index.d.ts:359


index

index: number

Defined in

dist/index.d.ts:107