---
category: Sensors
---
# useInfiniteScroll
Infinite scrolling of the element.
## Usage
```vue
{{ item }}
```
## Direction
Different scroll directions require different CSS style settings:
| Direction | Required CSS |
| ------------------ | ----------------------------------------------------- |
| `bottom` (default) | No special settings required |
| `top` | `display: flex;` `flex-direction: column-reverse;` |
| `left` | `display: flex;` `flex-direction: row-reverse;` |
| `right` | `display: flex;` |
::: warning
Make sure to indicate when there is no more content to load with `canLoadMore`, otherwise `onLoadMore` will trigger as long as there is space for more content.
:::
## Directive Usage
```vue
{{ item }}
{{ item }}
```
## Type Declarations
```ts
type InfiniteScrollElement =
| HTMLElement
| SVGElement
| Window
| Document
| null
| undefined
export interface UseInfiniteScrollOptions<
T extends InfiniteScrollElement = InfiniteScrollElement,
> extends UseScrollOptions {
/**
* The minimum distance between the bottom of the element and the bottom of the viewport
*
* @default 0
*/
distance?: number
/**
* The direction in which to listen the scroll.
*
* @default 'bottom'
*/
direction?: "top" | "bottom" | "left" | "right"
/**
* The interval time between two load more (to avoid too many invokes).
*
* @default 100
*/
interval?: number
/**
* A function that determines whether more content can be loaded for a specific element.
* Should return `true` if loading more content is allowed for the given element,
* and `false` otherwise.
*/
canLoadMore?: (el: T) => boolean
}
/**
* Reactive infinite scroll.
*
* @see https://vueuse.org/useInfiniteScroll
*/
export declare function useInfiniteScroll(
element: MaybeRefOrGetter,
onLoadMore: (
state: UnwrapNestedRefs>,
) => Awaitable,
options?: UseInfiniteScrollOptions,
): {
isLoading: ComputedRef
reset(): void
}
```