bearnie

Carousel

A carousel component built with Keen Slider for smooth, touch-enabled sliding.

1
2
3

Installation

npx bearnie add carousel
npx bearnie add carousel

External dependency: This component requires Keen Slider, a lightweight touch slider library.

Usage

import {
  Carousel,
  CarouselContent,
  CarouselItem,
  CarouselPrevious,
  CarouselNext,
  CarouselDots,
} from "@/components/bearnie/carousel"
<Carousel>
  <CarouselContent>
    <CarouselItem>Slide 1</CarouselItem>
    <CarouselItem>Slide 2</CarouselItem>
    <CarouselItem>Slide 3</CarouselItem>
  </CarouselContent>
  <CarouselPrevious />
  <CarouselNext />
</Carousel>

Examples

With dots

Slide 1
Slide 2
Slide 3

With thumbnails

Clickable previews below the carousel; the active thumbnail is highlighted as slides change.

Slide 1
Slide 2
Slide 3

Loop

1
2
3

Autoplay

Auto 1
Auto 2
Auto 3

Multiple slides per view

1
2
3
4
5

Responsive breakpoints

Override slidesPerView and spacing per media query with the breakpoints prop. This example shows one slide on mobile, two from 768px, and three from 1024px — resize the window to see it change.

1
2
3
4
5

Props

Prop Type Default Description
loop boolean false Enable infinite loop
autoplay boolean false Auto-advance slides
autoplayDelay number 4000 Delay between slides in ms
pauseOnHover boolean true Pause autoplay on hover
slidesPerView number | “auto” 1 Slides visible at once
spacing number 16 Gap between slides in px
orientation “horizontal” | “vertical” “horizontal” Slide direction
breakpoints Record<string, { slidesPerView?, spacing? }> - Per-media-query overrides, e.g. { "(min-width: 768px)": { slidesPerView: 2 } }

CarouselDots

Prop Type Default Description
count number required Number of dots to display

CarouselThumbnails / CarouselThumbnail

Container and clickable thumbnail buttons rendered below the carousel — one CarouselThumbnail per slide, in slide order. The active thumbnail gets a data-active attribute (styled with a primary border by default). Both accept class for additional CSS classes.

Accessibility

  • Navigation buttons have proper aria-labels
  • Dots indicate current slide position
  • Touch and swipe gestures supported
  • Keyboard navigation supported (arrow keys when focused)