Interface: ScrollIntoViewLocationOptions
Extended by
Properties
align?
optionalalign:"center"|"end"|"start"
behavior?
optionalbehavior:"auto"|"smooth"
calculateViewLocation?
optionalcalculateViewLocation: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
}
done()?
optionaldone: () =>void
Will be called when the scroll is done, or immediately if no scroll is needed.
Returns
void