Carousel example

Native slides with explicit rotation controls.

Touch, trackpad and keyboard navigation share a native scroll region. Automatic rotation is opt-in and pauses for interaction or reduced motion.

Complete React client module · MIT · Next.js and Vite

Interactive example

Native slides with explicit rotation controls

Touch, trackpad and keyboard navigation share a native scroll region. Automatic rotation is opt-in and pauses for interaction or reduced motion.

Keyboard

  • Focus the slides and use arrows, Home or End. Previous and Next keep button focus.
  • Focus stops automatic rotation until Start automatic rotation is selected again.

States covered

  • native touch scroll
  • keyboard navigation
  • opt-in autoplay
  • pause and resume
  • hover and visibility pause
  • reduced motion

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-carousel-native-controls.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,Carousel,Checkbox} from '@bld8/ui';
export default function ReviewCarousel(){const [auto,setAuto]=useState(false),[result,setResult]=useState('No review opened.');return <section><Checkbox label="Enable automatic rotation" checked={auto} onCheckedChange={setAuto}/><div style={{marginTop:20}}><Carousel label="Review stories" autoplay={auto?3000:undefined} items={['Keyboard','Spacing','Recovery'].map((title,index)=>({id:title.toLowerCase(),label:title+' review',content:<article style={{padding:28,minHeight:240,background:index===0?'var(--bui-selected-bg)':'var(--bui-surface)',borderRadius:8}}><p className="bui-hint">0{index+1} / INTERFACE REVIEW</p><h3>{title} review</h3><p>Keep the interaction clear, including the way back.</p><Button variant="secondary" onClick={()=>setResult(title+' review opened in this local example.')}>Review {title.toLowerCase()}</Button></article>}))}/></div><p role="status">{result}</p></section>;}