Directory
- Welcome
Card Carousel Component
The Card Carousel component creates an interactive, touch-enabled carousel with navigation controls and position indicators. Perfect for showcasing content in a structured, paginated format with smooth transitions and infinite scroll capability.
Live Demo
TypeScript
Strongly typed programming language that builds on JavaScript
Powerful animation library for creating complex animations
Cloudflare Pages
Secure and fast hosting solution with a generous free tier.
Reliable and scalable database solution.
Modern static site generator with island architecture for optimal performance
Utility-first CSS framework for rapid UI development
Key Features
-
Navigation Controls: Intuitive prev/next buttons with keyboard support
-
Position Indicators: Interactive dots showing current slide position
-
Touch Support: Swipe gestures for mobile devices with smooth transitions
-
Infinite Scroll: Seamless looping with smooth transitions between sets
-
Accessibility: Full keyboard navigation and ARIA support
Implementation
<CarouselCard> <div class="flex flex-col bg-bg-card shadow-card w-[250px] min-w-min gap-2 p-6 shrink-0"> <div class="flex flex-row items-center gap-2"> <h3 class="w-full font-bold">Card 1</h3> </div> <p class="text-text-secondary w-fit text-sm">Card 1 description</p> </div> <!-- Your items --></CarouselCard>
TypeScript
Strongly typed programming language that builds on JavaScript
Powerful animation library for creating complex animations
Cloudflare Pages
Secure and fast hosting solution with a generous free tier.
Reliable and scalable database solution.
Modern static site generator with island architecture for optimal performance
Utility-first CSS framework for rapid UI development
<CarouselCard infinite fadeEdges showDots class="custom-carousel" rowProps={{ class: 'items-center gap-4' }}> <!-- Your items --></CarouselCard>
Card Carousel Component Props API
Prop | Type | Default | Description |
---|---|---|---|
dotListProps | HTMLAttributes<"div"> | Props for the dot list wrapper | |
fadeEdges | boolean | true | Enable gradient fade effect on edges |
infinite | boolean | false | Enable infinite scroll functionality |
navButtonProps | ComponentProps<typeof Button> | Props for the navigation buttons | |
rowProps | HTMLAttributes<"ul"> | Props for the carousel track element | |
showDots | boolean | false | Show position indicator dots |
showNavigation | boolean | true | Show navigation buttons |
Features in Detail
Infinite Scroll
The infinite scroll feature provides a seamless, endless browsing experience:
-
Automatically clones items to create smooth transitions
-
Maintains consistent navigation and dot indicators
-
Seamlessly jumps between item sets without visual interruption
-
Preserves correct item order and positioning
<CarouselCard infinite> <!-- Your items --></CarouselCard>
Navigation System
The carousel provides multiple ways to navigate:
-
Button Controls
- Previous/Next buttons for manual navigation
- Automatically handles infinite scroll transitions
- Visible hover states and accessibility support
-
Dot Indicators
- Interactive dots showing current position
- Click to jump to specific slides
- Keyboard navigation support (Left/Right arrows)
- Maintains correct position with infinite scroll
-
Touch Navigation
- Swipe gestures for mobile devices
- Smooth transitions between slides
- Minimum swipe threshold for intentional navigation
Accessibility Features
The component implements several accessibility enhancements:
-
ARIA roles and labels for interactive elements
-
Keyboard navigation support throughout
-
Focus management for dot indicators
-
Screen reader friendly navigation
-
Proper tab order and focus states
Best Practices
-
Content Guidelines
- Use consistent card dimensions
- Keep content concise and scannable
- Maintain adequate spacing between cards
-
Responsive Design
- Test navigation on all devices
- Adjust card sizes for different screens
- Ensure touch targets are accessible
Common Use Cases
Limited Time Launch Sale
Add engaging, interactive card carousels to your website today with our AstroJS starter template. Get started now!
GET 60% OFF!