Traken UI

Carousel

The `Hero` component creates a visually engaging section with dynamic text and image animations, ideal for headers or landing pages.


Switzerland

Renowned for its breathtaking Alpine scenery and precision in craftsmanship

Install Dependencies

npm install motion react-icons

Add util file

Create a file named utils.ts in the same directory as the component and add the following code:

lib/utils.ts

import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Use this component in your app

<ImageSlider />
Slide 1

Install Dependencies

npm install motion react-icons

Add util file

Create a file named utils.ts in the same directory as the component and add the following code:

lib/utils.ts

import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Use this component in your app

<ImageSlider />
Slide 1

Install Dependencies

npm install motion react-icons

Add util file

Create a file named utils.ts in the same directory as the component and add the following code:

lib/utils.ts

import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Use this component in your app

<ImageSlider />
Slide 1

Install Dependencies

npm install motion react-icons

Add util file

Create a file named utils.ts in the same directory as the component and add the following code:

lib/utils.ts

import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

Use this component in your app

<ImageSlider />

Image Slider Props

PropTypeDefaultDescription
slidesSlide[][]Array of slide objects with image, title, and description
autoPlaybooleanfalseWhether the carousel should automatically advance slides
autoPlayIntervalnumber3000Time in milliseconds between slide transitions when autoPlay is true
classNamestring""Additional CSS classes for the carousel component
containerClassNamestring""Additional CSS classes for the slides container
buttonClassNamestring""Additional CSS classes for navigation buttons
onSeeMore(slide: Slide) => voidundefinedCallback function when "See More" is clicked for a slide
prevButtonContentReact.ReactNode"←"Custom content for the previous button
nextButtonContentReact.ReactNode"→"Custom content for the next button
thumbnailCountnumber5Number of thumbnail indicators to display

PropTypeDefaultDescription
imagesstring[]Sample imagesArray of image URLs to display in the carousel
autoPlaybooleanfalseWhether the carousel should automatically advance slides
intervalnumber3000Time in milliseconds between slide transitions when autoPlay is true
animationType"fade" | "slide" | "zoom""fade"Type of transition animation between slides
showControlsbooleantrueWhether to display navigation arrows and indicators
heightstring | number"400px"Height of the carousel container
widthstring | number"100%"Width of the carousel container