Components
- Accordion
- Alert
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendarnew
- Card
- Carousel
- Checkbox
- Chip
- Collapse
- Dialog
- Drawer
- Footer
- Gallery
- Icon Button
- Image
- Input
- List
- Mapnew
- Menu
- Navbar
- Pagination
- Popover
- Progress
- Radio
- Rating
- Select
- Sidebar
- Skeletonnew
- Slider
- Software Purchase Card
- Sonner / Toastnew
- Speed Dial
- Spinner
- Stepper
- Switch
- Table
- Tabs
- Textarea
- Timeline
- Tooltip
- Typography
- Video


"use client"
import Image from "next/image"
import { Navigation, Pagination } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import "swiper/css"
import "swiper/css/navigation"
import "swiper/css/pagination"
export function CarouselDemo() {
const images = [
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-3.jpg",
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-2.jpg",
"https://images.unsplash.com/photo-1501854140801-50d01698950b?auto=format&w=2000&q=85",
]
return (
<>
<style jsx global>{`
.swiper-button-next,
.swiper-button-prev {
color: white !important;
width: 24px !important;
height: 24px !important;
}
.swiper-button-next:after,
.swiper-button-prev:after {
font-size: 24px !important;
}
.swiper-pagination-bullet {
background: white !important;
}
`}</style>
<div className="w-full max-w-4xl">
<Swiper
modules={[Navigation, Pagination]}
navigation
pagination={{ clickable: true }}
spaceBetween={30}
slidesPerView={1}
className="rounded-lg"
>
{images.map((image, index) => (
<SwiperSlide key={index}>
<div className="relative aspect-video w-full overflow-hidden rounded-lg">
<img
src={image}
alt={`Slide ${index + 1}`}
className="object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
</div>
</>
)
}
Installation
pnpm dlx @creative-tim/ui@latest add carousel
Required Dependency
This component requires the swiper npm package to be installed. Make sure
to run: bash npm install swiper
Usage
import Image from "next/image"
import { Navigation, Pagination } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import "swiper/css"
import "swiper/css/navigation"
import "swiper/css/pagination"
export default function MyCarousel() {
return (
<Swiper
modules={[Navigation, Pagination]}
navigation
pagination={{ clickable: true }}
spaceBetween={30}
slidesPerView={1}
>
<SwiperSlide>
<Image src="/image1.jpg" alt="Slide 1" width={800} height={400} />
</SwiperSlide>
<SwiperSlide>
<Image src="/image2.jpg" alt="Slide 2" width={800} height={400} />
</SwiperSlide>
</Swiper>
)
}Examples
Carousel Basic
A simple carousel with navigation arrows and pagination dots.


"use client"
import Image from "next/image"
import { Navigation, Pagination } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import "swiper/css"
import "swiper/css/navigation"
import "swiper/css/pagination"
export function CarouselDemo() {
const images = [
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-3.jpg",
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-2.jpg",
"https://images.unsplash.com/photo-1501854140801-50d01698950b?auto=format&w=2000&q=85",
]
return (
<>
<style jsx global>{`
.swiper-button-next,
.swiper-button-prev {
color: white !important;
width: 24px !important;
height: 24px !important;
}
.swiper-button-next:after,
.swiper-button-prev:after {
font-size: 24px !important;
}
.swiper-pagination-bullet {
background: white !important;
}
`}</style>
<div className="w-full max-w-4xl">
<Swiper
modules={[Navigation, Pagination]}
navigation
pagination={{ clickable: true }}
spaceBetween={30}
slidesPerView={1}
className="rounded-lg"
>
{images.map((image, index) => (
<SwiperSlide key={index}>
<div className="relative aspect-video w-full overflow-hidden rounded-lg">
<img
src={image}
alt={`Slide ${index + 1}`}
className="object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
</div>
</>
)
}
Carousel with Thumbnails
A carousel featuring thumbnail navigation for quick slide access.




"use client"
import { useState } from "react"
import Image from "next/image"
import type { Swiper as SwiperType } from "swiper"
import { FreeMode, Navigation, Thumbs } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import "swiper/css"
import "swiper/css/free-mode"
import "swiper/css/navigation"
import "swiper/css/thumbs"
export function CarouselWithThumbnails() {
const [thumbsSwiper, setThumbsSwiper] = useState<SwiperType | null>(null)
const images = [
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-3.jpg",
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-2.jpg",
"https://images.unsplash.com/photo-1501854140801-50d01698950b?auto=format&w=2000&q=85",
]
return (
<>
<style jsx global>{`
.swiper-button-next,
.swiper-button-prev {
color: white !important;
width: 24px !important;
height: 24px !important;
}
.swiper-button-next:after,
.swiper-button-prev:after {
font-size: 24px !important;
}
`}</style>
<div className="w-full max-w-4xl space-y-4">
<Swiper
modules={[FreeMode, Navigation, Thumbs]}
spaceBetween={10}
navigation
thumbs={{ swiper: thumbsSwiper }}
className="rounded-lg"
>
{images.map((image, index) => (
<SwiperSlide key={index}>
<div className="relative aspect-video w-full overflow-hidden rounded-lg">
<img
src={image}
alt={`Slide ${index + 1}`}
className="object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
<Swiper
onSwiper={setThumbsSwiper}
modules={[FreeMode, Navigation, Thumbs]}
spaceBetween={10}
slidesPerView={3}
freeMode
watchSlidesProgress
className="rounded-lg"
>
{images.map((image, index) => (
<SwiperSlide key={index} className="cursor-pointer">
<div className="relative aspect-video w-full overflow-hidden rounded-lg">
<img
src={image}
alt={`Thumbnail ${index + 1}`}
className="object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
</div>
</>
)
}
Carousel with Autoplay
An auto-advancing carousel with dynamic pagination bullets.


"use client"
import Image from "next/image"
import { Autoplay, Pagination } from "swiper/modules"
import { Swiper, SwiperSlide } from "swiper/react"
import "swiper/css"
import "swiper/css/pagination"
export function CarouselAutoplay() {
const images = [
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-3.jpg",
"https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/creative-ai/bg-2.jpg",
"https://images.unsplash.com/photo-1501854140801-50d01698950b?auto=format&w=2000&q=85",
]
return (
<>
<style jsx global>{`
.swiper-pagination-bullet {
background: white !important;
}
`}</style>
<div className="w-full max-w-4xl">
<Swiper
modules={[Autoplay, Pagination]}
autoplay={{
delay: 3000,
disableOnInteraction: false,
}}
pagination={{
clickable: true,
dynamicBullets: true,
}}
loop
spaceBetween={30}
slidesPerView={1}
className="rounded-lg"
>
{images.map((image, index) => (
<SwiperSlide key={index}>
<div className="relative aspect-video w-full overflow-hidden rounded-lg">
<img
src={image}
alt={`Slide ${index + 1}`}
className="object-cover"
/>
</div>
</SwiperSlide>
))}
</Swiper>
</div>
</>
)
}
Features
- Navigation: Previous/Next arrow buttons for manual slide control
- Pagination: Clickable dots for direct slide access
- Thumbnails: Thumbnail navigation for enhanced user experience
- Autoplay: Automatic slide progression with customizable delay
- Responsive: Fully responsive design that works on all screen sizes
- Loop: Infinite loop mode for continuous sliding
- Customizable: Extensive configuration options through Swiper API
Swiper Modules
The carousel component uses various Swiper modules for different features:
- Navigation: Adds previous/next buttons
- Pagination: Adds pagination dots
- Autoplay: Enables automatic slide progression
- Thumbs: Enables thumbnail navigation
- FreeMode: Allows free scrolling without snapping
Configuration
You can customize the carousel behavior using Swiper options:
<Swiper
spaceBetween={30} // Space between slides
slidesPerView={1} // Number of slides per view
loop={true} // Enable infinite loop
autoplay={{
delay: 3000, // Delay between slides in ms
disableOnInteraction: false,
}}
pagination={{
clickable: true, // Enable clickable pagination
dynamicBullets: true, // Dynamic bullet sizing
}}
>
{/* Slides */}
</Swiper>Best Practices
- Image Optimization: Use Next.js
Imagecomponent for optimal performance - Alt Text: Always provide descriptive alt text for accessibility
- Aspect Ratio: Maintain consistent aspect ratios across all slides
- Loading Priority: Set
priority={true}for the first slide to improve LCP - Autoplay Delay: Use 3000-5000ms delay for comfortable viewing experience
Resources
Integrate the blocks in your application or use them in v0, Lovable, Claude, etc.
Speed up your workflow with modular, open-source components and blocksthat integrate effortlessly through Registries and MCPs.
Talk to an expert