Skip to main content

Overview

Toast Tabs combines an avatar row with a floating toast card. The active avatar grows and gains a colored SVG progress ring that fills as the autoplay timer advances. Hovering pauses the timer; clicking an avatar resets and activates it. All transitions use Framer Motion’s popLayout mode for seamless enter/exit sequencing.

Installation

Or copy the component manually from components/rareui/ToastTabs.tsx into your project.

Usage

Props

TabData[]
default:"defaultTabs"
Array of tab data objects. Each entry requires id: string | number, image: string (avatar URL), title: string, and description: string (quote or summary shown in the toast card).
boolean
default:"true"
When true, the component automatically advances to the next tab after each autoplayDelay interval. Pauses on mouse enter and resumes on mouse leave.
number
default:"3000"
Duration in milliseconds between automatic tab advances. The progress ring fills over this duration to indicate remaining time.
string
default:"#f97316"
CSS color value for the SVG progress ring around the active avatar. In dark mode, the ring always renders as white regardless of this value.
string
Additional Tailwind or CSS classes applied to the outermost container <div>.

Examples

Custom tabs with a blue ring

Static display without autoplay

When autoplay is false, the active avatar still shows the colored ring, but it renders as a static full circle rather than a progress arc.

Features

Animated Progress Ring

An SVG stroke-dashoffset driven by a Framer Motion value fills around the active avatar as the autoplay timer counts down.

Toast Content Card

Active tab content animates in and out using AnimatePresence with popLayout mode for smooth positional sequencing.

Autoplay with Pause

The timer advances using useAnimationFrame for frame-accurate progress tracking and pauses automatically on hover.

Keyboard Navigation

Arrow Left / Arrow Right keys move between avatars, reset the progress ring, and shift focus — fully accessible.

Customizable Ring Color

Pass any valid CSS color to ringColor to match your brand. Overridden to white automatically in dark mode.

Grayscale Inactive Avatars

Inactive avatars are desaturated and dimmed, creating clear visual hierarchy that lifts on hover.