Scroll Area
Augments native scroll functionality for custom, cross-browser styling and supports virtual scrolling for large lists.
Component Features
- Custom scrollbar styling across all browsers.
- Supports vertical, horizontal, or both directions.
- Smooth scrolling support.
- Scroll position and edge detection events.
- Virtual Scrolling support for rendering massive lists efficiently.
Both Directions
Example
Smooth Scroll & Events
Example
With Table
Recent Orders
Example
Infinite Scroll
Example
Virtual Scrolling
You can enable virtual scrolling to render lists with thousands of items without performance issues.
Example
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
type | 'auto' | 'always' | 'scroll' | 'hover' | 'hover' | Describes the nature of scrollbar visibility. |
direction | 'vertical' | 'horizontal' | 'both' | 'vertical' | The direction of the scroll area. |
smooth | boolean | false | Enables smooth scrolling behavior. |
scrollThreshold | number | 0 | Distance in pixels from the edge to trigger infinite scroll events. |
virtualScroll | boolean | false | Enables virtual scrolling mode. |
items | any[] | [] | Array of items to render when virtual scrolling is enabled. |
itemHeight | number | 40 | Fixed height of each item in pixels for virtual scrolling. |
Events
| Name | Parameters | Description |
|---|---|---|
scroll-position | (position: { x: number; y: number }) | Emitted when scrolling occurs, providing current coordinates. |
scroll-top | - | Emitted when scrolled to the top edge (considering threshold). |
scroll-bottom | - | Emitted when scrolled to the bottom edge (considering threshold). |
scroll-left | - | Emitted when scrolled to the left edge (considering threshold). |
scroll-right | - | Emitted when scrolled to the right edge (considering threshold). |
Slots
| Name | Scope | Description |
|---|---|---|
default | - | The main content to be scrolled. |
item | { item: any, index: number } | Custom template for each item in virtual scroll mode. |