Testimonials 1
smoothui-registry/testimonials-1FreeBlock
Simple testimonials block with auto-rotating cards
Install it
npx shadcn@latest add https://www.smoothui.dev/r/testimonials-1.jsonSource
1"use client";23import { getAvatarUrl, getTestimonials } from "@/lib/smoothui-data";4import { AnimatePresence, motion, useReducedMotion } from "motion/react";5import { useEffect, useRef, useState } from "react";67const TESTIMONIAL_COUNT = 4;8const AVATAR_SIZE = 96;9const DURATION = 5000; // ms10const BAR_WIDTH = 50;11const CIRCLE_SIZE = 12;12const BORDER_RADIUS_ACTIVE = 8;13const BORDER_RADIUS_INACTIVE = 999;14const MILLISECONDS_TO_SECONDS = 1000;1516const testimonials = getTestimonials(TESTIMONIAL_COUNT).map((testimonial) => ({17 avatar: testimonial.avatar,18 name: testimonial.name,19 quote: testimonial.content || "",20 role: testimonial.role,21}));2223export function TestimonialsSimple() {24 const shouldReduceMotion = useReducedMotion();25 const [index, setIndex] = useState(0);26 const timeoutRef = useRef<NodeJS.Timeout | null>(null);2728 useEffect(() => {29 timeoutRef.current = setTimeout(() => {30 setIndex((prev) => (prev + 1) % testimonials.length);31 }, DURATION);3233 return () => {34 if (timeoutRef.current) {35 clearTimeout(timeoutRef.current);36 }37 };38 }, []);3940 return (41 <section className="relative flex flex-col items-center bg-background py-16">42 <div className="flex w-full max-w-5xl flex-col items-center justify-center px-4">43 <div className="min-h-[120px] w-full">44 <AnimatePresence mode="wait">45 <motion.blockquote46 animate={47 shouldReduceMotion ? { opacity: 1 } : { opacity: 1, y: 0 }48 }49 className="mb-8 text-center font-semibold text-2xl text-foreground leading-tight md:text-4xl"50 exit={51 shouldReduceMotion52 ? { opacity: 0, transition: { duration: 0 } }53 : { opacity: 0, y: -30 }54 }55 initial={56 shouldReduceMotion ? { opacity: 1 } : { opacity: 0, y: 30 }57 }58 key={index}59 transition={60 shouldReduceMotion61 ? { duration: 0 }62 : { duration: 0.5, type: "spring" as const }63 }64 >65 “{testimonials[index].quote}”66 </motion.blockquote>67 </AnimatePresence>68 </div>69 <div className="flex w-full max-w-lg items-center justify-center gap-8 pt-8">70 <AnimatePresence initial={false} mode="wait">71 <motion.div72 animate={73 shouldReduceMotion74// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from SmoothUI Registry
All 178 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chat Templatechat-template | SmoothUI Registry | Blocks | Free | 2 deps · 4 files | |
| Cta 1cta-1 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Cta 2cta-2 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Cta 3cta-3 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Faq 1faq-1 | SmoothUI Registry | Blocks | Free | 2 deps | |
| Faq 2faq-2 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Faq 3faq-3 | SmoothUI Registry | Blocks | Free | 2 deps | |
| Faq 4faq-4 | SmoothUI Registry | Blocks | Free | 2 deps |
