diff --git a/docs/api/autoplay.mdx b/docs/api/autoplay.mdx
index 01286a8b..572c726b 100644
--- a/docs/api/autoplay.mdx
+++ b/docs/api/autoplay.mdx
@@ -14,7 +14,7 @@ For accessibility, the carousel will pause when the user is interacting with it.
| `autoplay` | boolean | `false` |
| `autoplayInterval` | number | `3000` |
-### Example
+#### Example
@@ -31,3 +31,26 @@ For accessibility, the carousel will pause when the user is interacting with it.
```
+
+### Navigation Arrows
+
+| Prop Name | Type | Default Value |
+| :----------------- | :------ | :------------ |
+| `autoplay` | boolean | `false` |
+| `showArrows` | boolean \| `always` \| `hover` | `false` |
+
+
+
+
+
+
+
+#### Code
+
+```tsx
+
+
+
+
+
+```
\ No newline at end of file
diff --git a/packages/nuka/src/Carousel/Carousel.tsx b/packages/nuka/src/Carousel/Carousel.tsx
index db0fbb24..9784a30b 100644
--- a/packages/nuka/src/Carousel/Carousel.tsx
+++ b/packages/nuka/src/Carousel/Carousel.tsx
@@ -64,6 +64,7 @@ export const Carousel = forwardRef(
const carouselRef = useRef(null);
const containerRef = useRef(null);
const previousPageRef = useRef(-1);
+ const arrowsContainerRef = useRef(null);
// -- update page count and scroll offset based on scroll distance
const { totalPages, scrollOffset } = useMeasurement({
@@ -126,8 +127,13 @@ export const Carousel = forwardRef(
// -- autoplay
const isHovered = useHover({ element: containerRef, enabled: autoplay });
+ const isArrowHovered = useHover({
+ element: arrowsContainerRef,
+ enabled: autoplay && showArrows === true,
+ });
const prefersReducedMotion = useReducedMotion({ enabled: autoplay });
- const autoplayEnabled = autoplay && !(isHovered || prefersReducedMotion);
+ const autoplayEnabled =
+ autoplay && !(isHovered || prefersReducedMotion || isArrowHovered);
useInterval(goForward, autoplayInterval, autoplayEnabled);
// -- scroll container when page index changes
@@ -191,7 +197,7 @@ export const Carousel = forwardRef(
{children}
- {showArrows && arrows}
+ {showArrows && {arrows}
}
{showDots && dots}