Carousel
The Carousel component provides an interactive way to showcase features, content, or media in a horizontally scrollable list.
Overview
The Carousel component provides an interactive way to showcase features, content, or media in a horizontally scrollable list. It combines two parts:
- HorizontalCard → A horizontally scrollable container with left/right navigation arrows.
- FeaturesCarousel → A feature-specific implementation using
HorizontalCard.tsx
, which also supports opening a modal to show more details about each item.
This is useful when you want to display multiple features, showcasing product highlights and even creating media galleries with modal previews.
Preview
How It Works
-
HorizontalCard
- Provides a horizontally scrollable container for feature cards.
- Each card is clickable and opens the modal when triggered.
-
Dialog
- Used to show the feature details in a modal view.
- Contains
DialogTrigger
,DialogBody
,DialogContent
, andDialogClose
.
-
FeaturesCarousel
- Wraps multiple feature cards inside
HorizontalCard
. - Each card is clickable and opens a modal (
Dialog
). - The modal displays a larger image and additional details.
- Wraps multiple feature cards inside
-
Features State
- A useState hook tracks the currently selected feature (
currentFeatureIndex
).
- A useState hook tracks the currently selected feature (
-
Feature Cards
- Each feature has an image, title, description, and expanded view (
open
).
- Each feature has an image, title, description, and expanded view (
Usage
To use the Carousel in your project:
- Import the components
Also import the Dialog components:
- Prepare your data
Each item should follow the Feature interface:
- Render the carousel
Below is a simplified version of the FeaturesCarousel component you can copy and adapt:
- Customize Content
- Replace
features
array with your own data. - Adjust styling inside
HorizontalCard
orFeaturesCarousel
if needed. - Optional: add more controls or customize modal layout.
- Replace
Best for: Showcasing features, services, or image galleries in a compact scrollable view, with modal support for expanded content.