Components
Carousel
Slides that snap as they scroll, with previous and next buttons, one dot per slide and a counter. It never autoplays.
Ombelle · light
Carousel
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add carouselAdds components/ui/carousel.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots, CarouselCounter } from '@/components/ui/carousel'
import { Card, CardContent, CardFooter } from '@/components/ui/card'
import { Badge } from '@/components/ui/badge'
const presets = [{ name: 'Ombelle', stable: true }, { name: 'Flat', stable: true }, { name: 'Minimalist', stable: true }, { name: 'Neo brutalism', stable: true }, { name: 'Liquid glass', stable: false }]
export function Example(){return <Carousel aria-label="Built-in presets" slidesPerView={2}><CarouselContent>{presets.map(preset => <CarouselItem key={preset.name}><Card><CardContent><img src={`/presets/${preset.name.toLowerCase().replace(' ', '-')}.png`} alt="" /></CardContent><CardFooter><strong>{preset.name}</strong><Badge variant={preset.stable ? 'secondary' : 'outline'}>{preset.stable ? 'Stable' : 'Experimental'}</Badge></CardFooter></Card></CarouselItem>)}</CarouselContent><CarouselPrevious /><CarouselNext /><CarouselDots /><CarouselCounter /></Carousel>}API and states
- API
- Carousel (slidesPerView 1, 2 or 3, variant default or image, ratio), CarouselContent, CarouselItem, CarouselImage (src, alt required, loading), CarouselPrevious, CarouselNext, CarouselDots, CarouselCounter, CarouselThumbnails
- Minimum states
- First slide, middle, last slide, one slide, focus, below 640px (no arrows), image with the next one peeking, current thumbnail
- Native basis
- CSS scroll snap with no dependency, one template for both editions
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.