Overlays & feedback / Toasts & snackbars
Sales Chat Floating Card
A white rounded card with a soft shadow in the bottom-right corner, showing overlapping round avatars, a green availability dot, a bold 'N sales reps available' heading, a muted line and a close icon. A dark navy 'Chat now' button sits below.
Rebuilt from stripe.com/pricing in the Iridescent Ledger style.
Looks exactly like stripe.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: count, heading, message, buttonLabel, hideAfter/showAfter (scroll range in px where it is visible), onChat, onClose. Fixed bottom-right; the close icon dismisses it permanently.
components/floating-sales-chat.tsx
import { useEffect, useState } from "react"; type Props = { count?: number; heading?: string; message?: string; buttonLabel?: string; hideAfter?: number; showAfter?: number; onChat?: () => void; onClose?: () => void; }; export default function SalesChatFloatingCard({ count = 9, heading = "specialists online", message = "Ask us anything about setting up your team.", buttonLabel = "Start chat", hideAfter = 900, showAfter = 80, onChat, onClose, }: Props) { const [dismissed, setDismissed] = useState(false); const [visible, setVisible] = useState(false); useEffect(() => { const update = () => { const y = window.scrollY; setVisible(y > showAfter && y < hideAfter); }; update(); const t = setTimeout(update, 50); window.addEventListener("scroll", update, { passive: true }); return () => { clearTimeout(t); window.removeEventListener("scroll", update); }; }, [hideAfter, showAfter]); if (dismissed) return null; const show = visible || (typeof window === "undefined"); return ( <div className={`fixed bottom-6 right-4 z-50 flex w-[calc(100%-2rem)] max-w-[350px] flex-col items-end gap-4 transition-[opacity,transform] duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none sm:right-6 ${show ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-8 opacity-0"}`} aria-hidden={!show} > <div className="relative w-full rounded-lg bg-surface p-4 shadow-floating"> <button type="button" aria-label="Dismiss chat prompt" onClick={() => { setDismissed(true); onClose?.(); }} className="absolute right-3 top-3 text-ink-faint transition-colors duration-link ease-link hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent rounded-pill" > <svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true"> <circle cx="10" cy="10" r="9" fill="currentColor" /> <path d="M7 7l6 6M13 7l-6 6" stroke="#fff" strokeWidth="1.6" strokeLinecap="round" /> </svg> </button> <div className="flex items-center gap-3 pr-8"> <div className="flex -space-x-2"> <span className="flex h-8 w-8 items-center justify-center rounded-pill border-2 border-surface bg-gradient-to-br from-signal-orange to-signal-magenta text-micro font-medium text-white">LM</span> <span className="flex h-8 w-8 items-center justify-center rounded-pill border-2 border-surface bg-gradient-to-br from-accent to-accent-soft text-micro font-medium text-white">RK</span> </div> <div className="flex items-center gap-1.5 text-ui font-semibold text-ink-deep"> <span className="h-2 w-2 rounded-pill bg-[#2ca06a]" aria-hidden="true" /> <span>{count} {heading}</span> </div> </div> <p className="mt-3 text-ui text-ink-muted">{message}</p> </div> <button type="button" onClick={onChat} className="rounded-sm bg-ink-deep px-6 py-2.5 text-ui font-medium text-white shadow-card transition-opacity duration-link ease-link hover:opacity-90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent" > {buttonLabel} </button> </div> ); }import { useEffect, useState } from "react"; type Props = { count?: number; heading?: string; message?: string; buttonLabel?: string; hideAfter?: number; showAfter?: number; onChat?: () => void; onClose?: () => void; }; export default function SalesChatFloatingCard({ count = 9, heading = "specialists online", message = "Ask us anything about setting up your team.", buttonLabel = "Start chat", hideAfter = 900, showAfter = 80, onChat, onClose, }: Props) { const [dismissed, setDismissed] = useState(false); const [visible, setVisible] = useState(false); useEffect(() => { const update = () => { const y = window.scrollY; setVisible(y > showAfter && y < hideAfter); }; update(); const t = setTimeout(update, 50); window.addEventListener("scroll", update, { passive: true }); return () => { clearTimeout(t); window.removeEventListener("scroll", update); }; }, [hideAfter, showAfter]); if (dismissed) return null; const show = visible || (typeof window === "undefined"); return ( <div className={`fixed bottom-6 right-4 z-50 flex w-[calc(100%-2rem)] max-w-[350px] flex-col items-end gap-4 transition-[opacity,transform] duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none sm:right-6 ${show ? "translate-y-0 opacity-100" : "pointer-events-none translate-y-8 opacity-0"}`} aria-hidden={!show} > <div className="relative w-full rounded-md bg-card p-4 shadow-iridescent-floating"> <button type="button" aria-label="Dismiss chat prompt" onClick={() => { setDismissed(true); onClose?.(); }} className="absolute right-3 top-3 text-muted-foreground transition-colors duration-iridescent-link ease-iridescent-link hover:text-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary rounded-full" > <svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true"> <circle cx="10" cy="10" r="9" fill="currentColor" /> <path d="M7 7l6 6M13 7l-6 6" stroke="var(--color-card)" strokeWidth="1.6" strokeLinecap="round" /> </svg> </button> <div className="flex items-center gap-3 pr-8"> <div className="flex -space-x-2"> <span className="flex h-8 w-8 items-center justify-center rounded-full border-2 border-card bg-gradient-to-br from-iridescent-signal-orange to-iridescent-signal-magenta text-iridescent-micro font-medium text-background">LM</span> <span className="flex h-8 w-8 items-center justify-center rounded-full border-2 border-card bg-gradient-to-br from-primary to-iridescent-accent-soft text-iridescent-micro font-medium text-background">RK</span> </div> <div className="flex items-center gap-1.5 text-iridescent-ui font-semibold text-muted-foreground"> <span className="h-2 w-2 rounded-full bg-[#2ca06a]" aria-hidden="true" /> <span>{count} {heading}</span> </div> </div> <p className="mt-3 text-iridescent-ui text-muted-foreground">{message}</p> </div> <button type="button" onClick={onChat} className="rounded-sm bg-foreground px-6 py-2.5 text-iridescent-ui font-medium text-background shadow-iridescent-card transition-opacity duration-iridescent-link ease-iridescent-link hover:opacity-90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary" > {buttonLabel} </button> </div> ); }
Quality checks
Automated, in a real browser · 5d ago- Accessible: not passedARIA hidden element must not be focusable or contain focusable elements (1 element)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: not passed1 hard-coded colour (bg-[#2ca06a]). These ignore the theme and break dark mode.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.