Prev / Next
Use isReachStart, isReachEnd, and moveTo from the Reactive API to build navigation buttons that automatically disable at the carousel boundaries.
- JavaScript
- React
- Vue@3
Summary
Key API
| Property / Method | Type | Description |
|---|---|---|
isReachStart | boolean | Whether the first panel is active |
isReachEnd | boolean | Whether the last panel is active |
currentPanelIndex | number | Currently active panel index |
moveTo | (i: number) => Promise | Move to a specific panel |
Button States
| Position | Prev Button | Next Button |
|---|---|---|
First panel (isReachStart) | disabled | enabled |
| Middle panel | enabled | enabled |
Last panel (isReachEnd) | enabled | disabled |
Details
How It Works
- Disable the Prev button when
isReachStartistrue - Disable the Next button when
isReachEndistrue - Prev click:
moveTo(currentPanelIndex - 1) - Next click:
moveTo(currentPanelIndex + 1) - Button states auto-sync when the user drags to a new panel
Related Options
circular: true: In circular mode,isReachStartandisReachEndare alwaysfalse, so both buttons remain enabled at all times.
Use Cases
When to use
- Desktop carousels where drag is less discoverable
- Accessibility (a11y) keyboard/button navigation
- Touch-disabled environments
Related Links
Related API
isReachStart: Start boundary flagisReachEnd: End boundary flag
Related Demos
- Pagination: Dot pagination
- Progress Bar: Scroll progress indicator