Julien Thibeaut

Carousel

Buttons 30

About

A flexible and easy-to-use carousel with customizable navigation and indicators.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Carousel to your project and fits it to your theme.

Code

How Carousel is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';
import {
  Carousel,
  CarouselContent,
  CarouselItem,
} from '@/components/ui/carousel';
import { useState } from 'react';

const ITEMS = new Array(4).fill(null).map((_, index) => index + 1);

export function CarouselCustomIndicator() {
  const [index, setIndex] = useState(0);

  return (
    <div className='relative w-full max-w-xs py-8'>
      <Carousel index={index} onIndexChange={setIndex}>
        <CarouselContent className='relative'>
          {ITEMS.map((item) => {
            return (
              <CarouselItem key={item} className='p-4'>
                <div className='flex aspect-square items-center justify-center border border-zinc-200 dark:border-zinc-800'>
                  {item}
                </div>
              </CarouselItem>
            );
          })}
        </CarouselContent>
      </Carousel>
      <div className='flex w-full justify-center space-x-3 px-4'>
        {ITEMS.map((item) => {
          return (
            <button
              key={item}
              type='button'
              aria-label={`Go to slide ${item}`}
              onClick={() => setIndex(item - 1)}
              className='h-12 w-12 border border-zinc-200 dark:border-zinc-800'
            >
              {item}
            </button>
          );
        })}
      </div>
    </div>
  );
}

Dependencies

More by Julien Thibeaut

View all
  • Dock

    Dock

    3.1K
  • Text Effect

    Text Effect

    1.6K
  • Infinite Slider

    Infinite Slider

    1.5K
  • Text Shimmer

    Text Shimmer

    1.3K
  • Text Scramble

    Text Scramble

    1.1K
  • Progressive blur

    Progressive blur

    683
  • Glow Effect

    Glow Effect

    610
  • Tailwind CSS Background Snippet

    Tailwind CSS Background Snippet

    535

More in Buttons

View all
  • Button

    Button

    14
  • Button

    Button

    34
  • Texture Button

    Texture Button

    92
  • Button Save

    Button Save

    46
  • Button

    Button

    64
  • Button Group

    Button Group

    3
  • App Store Button

    App Store Button

    454
  • Notification Button

    Notification Button

    103