Luca Perullo
Components

Component

LiveNew

Testimonial Carousel

Cross-fade puro CSS (opacity transition), pause su hover/focus, frecce ←/→ da tastiera, indicatore dot animato. Zero dipendenze, niente carousel library.

ConversionCarouselSocial ProofClient
Open in ClaudeSorgente

Esempio01

testimonial-carousel.tsx

Luca ha rifatto il nostro sito in 3 settimane: bounce rate -38%.

S
Sara R.CEO, Studio Krono
1/3

Note intervalMs={0} disabilita l'auto-advance. La regione è focusabile (tabIndex 0) e si pausa quando ha focus. Il min-height 140px evita layout shift quando il quote varia.

Prompt LLM02

Incolla in Claude o ChatGPT per generare la tua variante. Include il contesto del brand, i token e i vincoli del progetto.

Prompt · testimonial-carousel
Open in Claude
Sei un senior frontend engineer. Stai lavorando su un sito Next.js 16 + React 19 + Tailwind v4 in italiano, look chanhdai-inspired: colonna stretta 672px, Geist Sans + Geist Mono, hairline 1px, divisori a stripe diagonale, palette zinc.

Token CSS disponibili: --bg, --bg-alt, --fg, --fg-muted, --fg-soft, --border, --border-strong, --accent. Usa SEMPRE queste variabili tramite le utility tailwind generate (bg-bg, text-fg-muted, border-border, ecc.). Helper "cn" da "@/lib/utils". Niente librerie UI extra: solo lucide-react e tailwind-merge.

Genera un componente <TestimonialCarousel> con auto-advance + pause-on-hover.
Type:
- Testimonial = { quote: string; name: string; role?: string; avatar?: string }
Props:
- items: Testimonial[].
- intervalMs?: number (default 5500, 0 = disabilita).
- className?: string.

Implementazione:
- "use client".
- useState per idx + paused. setInterval(idx → (idx+1) % len), clearInterval su unmount/paused.
- onMouseEnter/Leave + onFocus/Blur per togglare paused.
- Keyboard: ArrowLeft/Right su window, attivi solo se focus interno.
- Render: stack di <article> absolute inset-0 con opacity 0/100 transition 500ms ease-out. min-height 140px sul wrapper per non far saltare.
- Dot indicators: barre 1.5px (active = 6px wide bg-fg, others 1.5px wide bg-border-strong).
- Quote icon Lucide a header, footer con avatar (img o iniziale).

Output: file completo src/components/testimonial-carousel.tsx.

Uso tipico03

tsx
<TestimonialCarousel items={[{ quote, name, role, avatar? }, ...]} intervalMs={5500} />

Dipendenze04

npm
  • tailwind-merge
  • clsx
  • lucide-react
Interno
  • @/lib/utils#cn

Ti è servito? Dimmelo, oppure proponi il prossimo componente.