Updated
Testimonial Notifications
NewCustomize
Interval3200ms
hover
Depth2
Max height400px
Installation
npx shadcn@latest add https://uibrik.com/r/testimonial-notifications.jsonInstall the packages
npm install @tabler/icons-react motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/testimonial-notifications/testimonial-notifications.tsx"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent } from "react"; import { motion, useReducedMotion } from "motion/react"; import { IconChevronUp, IconStarFilled } from "@tabler/icons-react"; import { cn } from "@/lib/utils"; // Testimonial notifications. Testimonials arrive like notifications on a // phone's lock screen: a new card drops in on top and the earlier ones settle // back into a stack behind it, each showing only a sliver of its edge. // // The stack keeps one small footprint on the page however many testimonials // there are. Hover (or tap) it and it opens as a layer over the page rather // than pushing anything down: the cards fan out into a list that grows to at // most `maxHeight` and scrolls past that, with a header above it showing who's // in it and a button to fold it away. Leave and it folds back. // // Nothing scales. Cards behind the top one are narrowed and trimmed with // clip-path, so their text never squashes, and their content fades out while // they're tucked away. Positions come from each card's measured height, so // quotes of any length stack and fan out cleanly. Cards further back are // dimmed with a solid layer, not transparency, so the stack never shows // through itself. Autoplay holds while the stack is open, hovered, focused or // off screen.
Adds the files to
components/uibrik/testimonial-notifications and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/testimonial-notifications.Usage
import { TestimonialNotifications } from "@/components/uibrik/testimonial-notifications/testimonial-notifications";const items = [ { id: "hannah", name: "Hannah Cole", role: "Head of Design, Fable", avatar: "/registry/testimonial-notifications/hannah.webp", hue: 25, message: "We swapped our whole marketing site over in a sprint. Conversions went up and nobody had to fight the CSS.", }, { id: "tobi", name: "Tobi Adeyemi", role: "Engineer, Quill", avatar: "/registry/testimonial-notifications/tobi.webp", hue: 155, message: "The motion feels native. Interrupt anything and it just keeps going.", }, // …3 more];<TestimonialNotifications autoplay interval={3200} expandOn="hover" depth={2} maxHeight={400} items={items} defaultExpanded={false} // expanded={false} // onExpandedChange={(expanded) => {}}/>Where to use Testimonial Notifications
Hero sections
A compact stack beside the headline keeps fresh praise arriving without taking much room.
Pairs with Testimonial Thread
Mobile apps and tools
Notification cards look at home next to phone mockups and app screenshots.
Pairs with Avatar Stack
Pricing pages
A stack under the plans adds proof that people can open when they want it.
Pairs with Testimonial Carousel
Props
TestimonialNotifications- autoplay
- Type boolean
- true
- Bring in a new testimonial on a timer. Holds while open, hovered or off screen.
- interval
- Type number
- 3200
- Time between testimonials.
- expandOn
- Type "hover" | "click"
- "hover"
- Open on hover (taps still toggle), or only on click.
- depth
- Type number
- 2
- Cards peeking out behind the top one.
- maxHeight
- Type number
- 400
- Tallest the open list grows before it scrolls. It opens over the page, so nothing below moves.
- items
- Type { id: string; name: string; role?: string; message: string; avatar: string; hue: number }[]
- SAMPLE_NOTIFICATIONS
- Testimonials to cycle through. `hue` is an OKLCH hue (0–360) for the badge on the photo.
- expanded / onExpandedChange
- Type boolean / (expanded: boolean) => void
- –
- Controlled open state.
- defaultExpanded
- Type boolean
- false
- Open to begin with.
- className
- Type string
- –
- Classes for the stack.