Headers & navigation / Tab bars
Filter Pills with Featured Story Card
Eyebrow, heading and a row of pill tabs (the active one in solid purple with white text, the other in plain navy) beside a purple arrow link. A left stat column with marker rules leads to a large orange-duotone photo card with a logo and white bold caption.
Rebuilt from stripe.com/customers 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
Pass eyebrow, heading, linkLabel, and startup/enterprise story objects (stats, products, more, caption, brand, image). Clicking a pill slides the featured story horizontally over 350ms.
components/segmented-story-feature.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Story = { stats: { value: string; label: string }[]; products: string[]; more: number; caption: string; brand: string; image: string; }; export default function FilterPillsFeaturedStory(props: { eyebrow?: string; heading?: string; linkLabel?: string; startup?: Story; enterprise?: Story; }) { const { eyebrow = "Customers by size", heading = "Teams of every size across the globe rely on Northwind", linkLabel = "Browse all stories", startup = { stats: [ { value: "2 million+", label: "orders shipped by independent makers" }, { value: "30,000+", label: "active online storefronts" }, ], products: ["Checkout", "Invoicing"], more: 3, caption: "Kitefield passes two million orders with Northwind", brand: "kitefield", image: "https://yoink-app.fly.dev/stock/people-1.jpg", }, enterprise = { stats: [ { value: "140 countries", label: "served from a single platform" }, { value: "9x faster", label: "month-end close for finance teams" }, ], products: ["Treasury", "Reporting"], more: 4, caption: "Altura cuts its monthly close from weeks to days", brand: "altura", image: "https://yoink-app.fly.dev/stock/office-1.jpg", }, } = props; const [tab, setTab] = useState(0); const stories = [startup, enterprise]; const labels = ["Startup", "Enterprise"]; return ( <section className="bg-canvas px-4 py-16 sm:px-8 md:py-24"> <div className="mx-auto max-w-[1080px]"> <Reveal> <p className="text-ui font-medium text-accent">{eyebrow}</p> <h2 className="mt-5 max-w-[680px] text-h2 text-ink-deep">{heading}</h2> <div className="mt-8 flex flex-wrap items-center gap-2" role="tablist"> {labels.map((l, i) => ( <button key={l} role="tab" aria-selected={tab === i} onClick={() => setTab(i)} className={`rounded-pill px-4 py-1.5 text-ui font-medium duration-link ease-link focus-visible:outline-2 focus-visible:outline-accent ${tab === i ? "bg-accent text-white" : "text-ink-deep hover:text-accent"}`} > {l} </button> ))} <a href="#" className="ml-4 inline-flex items-center gap-1 text-ui font-medium text-accent focus-visible:outline-2 focus-visible:outline-accent"> {linkLabel} <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true"><path d="M4.5 2.5 8 6l-3.5 3.5" /></svg> </a> </div> </Reveal> <div className="mt-16 overflow-hidden"> <div className="flex transition-transform duration-[350ms] ease-[cubic-bezier(0.4,0,0.2,1)]" style={{ transform: `translateX(-${tab * 100}%)` }} > {stories.map((s, i) => ( <div key={i} aria-hidden={tab !== i} className="grid w-full shrink-0 gap-10 p-4 md:grid-cols-[270px_1fr] md:gap-0"> <div className="space-y-10"> {s.stats.map((st) => ( <div key={st.value} className="relative max-w-[200px]"> <span className="absolute -left-4 top-1 h-6 w-px bg-accent" /> <p className="text-h3 text-ink-deep">{st.value}</p> <p className="mt-2 text-ui text-ink-muted">{st.label}</p> </div> ))} <div className="relative"> <span className="absolute -left-4 top-0.5 h-4 w-px bg-accent" /> <p className="text-ui font-medium text-ink-deep">Products used</p> <ul className="mt-4 space-y-2 text-body text-ink-muted"> {s.products.map((p) => <li key={p}>{p}</li>)} <li className="flex items-center gap-3 text-ink-faint"> <span aria-hidden="true">•••</span>{s.more} more </li> </ul> </div> </div> <article className="relative isolate flex min-h-[320px] overflow-hidden rounded-lg shadow-floating md:min-h-[410px]"> <img src={s.image} alt="Person working on a laptop" width={1600} height={1067} loading="lazy" className="absolute inset-0 -z-20 h-full w-full object-cover grayscale" /> <div className="absolute inset-0 -z-10 bg-signal-orange mix-blend-multiply" /> <div className="absolute inset-0 -z-10 bg-gradient-to-t from-signal-orange via-signal-orange/30 to-signal-orange/40" /> <div className="flex w-full flex-col justify-between p-6"> <div className="flex items-center justify-between text-white"> <span className="flex items-center gap-2 text-lead font-medium"> <span className="h-3 w-3 rounded-xs bg-white" />{s.brand} </span> <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2" /><path d="M6 8h8M6 12h8" /></svg> </div> <h3 className="max-w-[460px] text-h3 font-bold text-white">{s.caption}</h3> </div> </article> </div> ))} </div> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Story = { stats: { value: string; label: string }[]; products: string[]; more: number; caption: string; brand: string; image: string; }; export default function FilterPillsFeaturedStory(props: { eyebrow?: string; heading?: string; linkLabel?: string; startup?: Story; enterprise?: Story; }) { const { eyebrow = "Customers by size", heading = "Teams of every size across the globe rely on Northwind", linkLabel = "Browse all stories", startup = { stats: [ { value: "2 million+", label: "orders shipped by independent makers" }, { value: "30,000+", label: "active online storefronts" }, ], products: ["Checkout", "Invoicing"], more: 3, caption: "Kitefield passes two million orders with Northwind", brand: "kitefield", image: "https://yoink-app.fly.dev/stock/people-1.jpg", }, enterprise = { stats: [ { value: "140 countries", label: "served from a single platform" }, { value: "9x faster", label: "month-end close for finance teams" }, ], products: ["Treasury", "Reporting"], more: 4, caption: "Altura cuts its monthly close from weeks to days", brand: "altura", image: "https://yoink-app.fly.dev/stock/office-1.jpg", }, } = props; const [tab, setTab] = useState(0); const stories = [startup, enterprise]; const labels = ["Startup", "Enterprise"]; return ( <section className="bg-background px-4 py-16 sm:px-8 md:py-24"> <div className="mx-auto max-w-[1080px]"> <Reveal> <p className="text-iridescent-ui font-medium text-primary">{eyebrow}</p> <h2 className="mt-5 max-w-[680px] text-iridescent-h2 text-muted-foreground">{heading}</h2> <div className="mt-8 flex flex-wrap items-center gap-2" role="tablist"> {labels.map((l, i) => ( <button key={l} role="tab" aria-selected={tab === i} onClick={() => setTab(i)} className={`rounded-full px-4 py-1.5 text-iridescent-ui font-medium duration-iridescent-link ease-iridescent-link focus-visible:outline-2 focus-visible:outline-primary ${tab === i ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-primary"}`} > {l} </button> ))} <a href="#" className="ml-4 inline-flex items-center gap-1 text-iridescent-ui font-medium text-primary focus-visible:outline-2 focus-visible:outline-primary"> {linkLabel} <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true"><path d="M4.5 2.5 8 6l-3.5 3.5" /></svg> </a> </div> </Reveal> <div className="mt-16 overflow-hidden"> <div className="flex transition-transform duration-[350ms] ease-[cubic-bezier(0.4,0,0.2,1)]" style={{ transform: `translateX(-${tab * 100}%)` }} > {stories.map((s, i) => ( <div key={i} aria-hidden={tab !== i} className="grid w-full shrink-0 gap-10 p-4 md:grid-cols-[270px_1fr] md:gap-0"> <div className="space-y-10"> {s.stats.map((st) => ( <div key={st.value} className="relative max-w-[200px]"> <span className="absolute -left-4 top-1 h-6 w-px bg-primary" /> <p className="text-iridescent-h3 text-muted-foreground">{st.value}</p> <p className="mt-2 text-iridescent-ui text-muted-foreground">{st.label}</p> </div> ))} <div className="relative"> <span className="absolute -left-4 top-0.5 h-4 w-px bg-primary" /> <p className="text-iridescent-ui font-medium text-muted-foreground">Products used</p> <ul className="mt-4 space-y-2 text-iridescent-body text-muted-foreground"> {s.products.map((p) => <li key={p}>{p}</li>)} <li className="flex items-center gap-3 text-muted-foreground"> <span aria-hidden="true">•••</span>{s.more} more </li> </ul> </div> </div> <article className="relative isolate flex min-h-[320px] overflow-hidden rounded-md shadow-iridescent-floating md:min-h-[410px]"> <img src={s.image} alt="Person working on a laptop" width={1600} height={1067} loading="lazy" className="absolute inset-0 -z-20 h-full w-full object-cover grayscale" /> <div className="absolute inset-0 -z-10 bg-iridescent-signal-orange mix-blend-multiply" /> <div className="absolute inset-0 -z-10 bg-gradient-to-t from-iridescent-signal-orange via-iridescent-signal-orange/30 to-iridescent-signal-orange/40" /> <div className="flex w-full flex-col justify-between p-6"> <div className="flex items-center justify-between text-background"> <span className="flex items-center gap-2 text-iridescent-lead font-medium"> <span className="h-3 w-3 rounded-sm bg-background" />{s.brand} </span> <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2" /><path d="M6 8h8M6 12h8" /></svg> </div> <h3 className="max-w-[460px] text-iridescent-h3 font-bold text-background">{s.caption}</h3> </div> </article> </div> ))} </div> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }
Quality checks
Automated, in a real browser · 5d ago- Accessible: not passedCertain ARIA roles must contain particular children (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: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.