Gradient Extension Card Carousel
Horizontally scrolling tall 360×536 cards, each tinted by its app's color (indigo, blue, green) with radial glows, an icon tile, name, arrow button, hairline divider and a live mini-demo. The row fades out at the edges, with round prev/next buttons and a 'Browse thousands more' link below.
Rebuilt from raycast.com in the Obsidian Launcher style.
Looks exactly like raycast.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: title, subtitle, cards (id, cat, name, desc, tint, glow, demo) and browseLabel. Tabs filter cards by category; prev/next buttons scroll the row.
components/gradient-extension-card-carousel.tsx
"use client"; import { useEffect, useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useRef, useState } from "react"; type Card = { id: string; cat: string; name: string; desc: string; tint: string; glow: string; demo: "rings" | "lines" | "player" | "bars" }; const DEFAULT_CARDS: Card[] = [ { id: "a", cat: "Productivity", name: "Northwind Tasks", desc: "Capture, sort and update your to-dos without lifting your hands off the keys.", tint: "linear-gradient(138deg, rgba(32,35,91,0.7) 22%, rgba(7,9,33,0.7) 82%)", glow: "rgba(90,80,220,0.35)", demo: "rings" }, { id: "b", cat: "Productivity", name: "Altura Lingo", desc: "Convert any phrase into many languages in a single quick step.", tint: "linear-gradient(138deg, rgba(20,40,90,0.75) 22%, rgba(7,12,33,0.7) 82%)", glow: "rgba(43,94,180,0.55)", demo: "lines" }, { id: "c", cat: "Productivity", name: "Lumen Sound", desc: "Find tracks and shows, open your playlists, and manage what is playing.", tint: "linear-gradient(138deg, rgba(20,70,40,0.75) 22%, rgba(8,25,15,0.7) 82%)", glow: "rgba(30,160,80,0.55)", demo: "player" }, { id: "d", cat: "Engineering", name: "Kitefield Deploy", desc: "Ship builds, watch logs and roll back releases from one prompt.", tint: "linear-gradient(138deg, rgba(70,30,40,0.75) 22%, rgba(25,8,12,0.7) 82%)", glow: "rgba(230,80,70,0.4)", demo: "bars" }, { id: "e", cat: "Design", name: "Prism Palette", desc: "Pick shades, copy tokens and preview contrast while you work.", tint: "linear-gradient(138deg, rgba(60,30,90,0.75) 22%, rgba(18,8,33,0.7) 82%)", glow: "rgba(160,80,220,0.4)", demo: "rings" }, { id: "f", cat: "Writing", name: "Quill Notes", desc: "Draft, tidy and search your notes without opening another window.", tint: "linear-gradient(138deg, rgba(60,50,20,0.75) 22%, rgba(25,18,8,0.7) 82%)", glow: "rgba(220,170,50,0.35)", demo: "lines" }, ]; const TABS = ["Productivity", "Engineering", "Design", "Writing"]; function Demo({ kind }: { kind: Card["demo"] }) { if (kind === "rings") return ( <div className="flex h-full items-end justify-between pb-3"> {["border-dashed border-primary", "border-primary", "border-accent-yellow", "border-accent-blue bg-accent-blue/60"].map((c, i) => ( <span key={i} className={`h-12 w-12 rounded-pill border-[3px] ${c}`} /> ))} </div> ); if (kind === "lines") return ( <div className="space-y-3 overflow-hidden pt-3 text-[20px] text-primary"> {["Warm soup of the day", "Sopa caliente del día", "Soupe chaude du jour", "Heisse Tagessuppe", "Zuppa calda oggi", "Sup panas hari ini"].map((t, i) => ( <div key={t} className={`whitespace-nowrap ${i % 2 ? "opacity-40" : ""}`}>{t}</div> ))} </div> ); if (kind === "player") return ( <div className="flex flex-col items-center gap-5 pt-3"> <div className="h-[200px] w-[200px] rounded-xs bg-[linear-gradient(135deg,#ddd,#555)] shadow-soft-glow" /> <div className="flex items-center gap-6 text-primary"> <span>◀◀</span> <span className="flex h-10 w-10 items-center justify-center rounded-pill bg-primary text-canvas">▶</span> <span>▶▶</span> </div> </div> ); return ( <div className="flex h-full items-end gap-3 pb-3"> {[40, 70, 55, 90, 65, 80].map((h, i) => ( <span key={i} className="flex-1 rounded-xs bg-accent-red/70" style={{ height: `${h}%` }} /> ))} </div> ); } export default function GradientExtensionCardCarousel({ title = "Plug in anything you use.", subtitle = "Run your everyday apps right from the launcher.", cards = DEFAULT_CARDS, browseLabel = "Explore the full catalog →", }: { title?: string; subtitle?: string; cards?: Card[]; browseLabel?: string }) { const [tab, setTab] = useState(TABS[0]); const ref = useRef<HTMLDivElement>(null); const shown = cards.filter((c) => c.cat === tab); const scroll = (d: number) => ref.current?.scrollBy({ left: d * 416, behavior: "smooth" }); const btn = "flex h-14 w-14 items-center justify-center rounded-pill border border-hairline bg-surface text-secondary shadow-[inset_0_1px_0_rgba(255,255,255,0.1)] transition-shadow duration-300 ease-in-out hover:shadow-[inset_0_1px_1px_rgba(255,255,255,0.1),0_2px_40px_10px_rgba(154,170,255,0.05)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue"; return ( <section className="bg-canvas px-6 py-24 font-sans text-primary md:px-[118px]"> <div className="flex flex-col justify-between gap-6 md:flex-row md:items-start"> <h2 className="max-w-sm text-body-lg"> <span className="text-primary">{title}</span> <br /> <span className="text-tertiary">{subtitle}</span> </h2> <div role="tablist" className="inline-flex self-start rounded-pill border border-hairline bg-overlay-subtle p-2 backdrop-blur-sm"> {TABS.map((t) => ( <button key={t} role="tab" aria-selected={tab === t} onClick={() => setTab(t)} className={`rounded-pill px-3 py-2.5 text-ui transition-colors duration-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue ${tab === t ? "bg-surface-hover text-primary" : "text-tertiary hover:text-primary"}`}> {t} </button> ))} </div> </div> <div className="mt-12 [mask-image:linear-gradient(to_right,transparent,#000_64px,#000_calc(100%-64px),transparent)]"> <div ref={ref} className="overflow-x-auto px-4 py-6 [scrollbar-width:none]"> <Stagger key={tab} step={100} from="up" distance={50} className="flex gap-14"> {shown.map((c) => ( <article key={c.id} className="relative flex h-[536px] w-[360px] shrink-0 flex-col overflow-hidden rounded-xl border border-hairline p-6" style={{ backgroundImage: `radial-gradient(94% 78% at 50% 30%, ${c.glow}, transparent), ${c.tint}` }}> <header className="flex items-center gap-3"> <span className="flex h-14 w-14 items-center justify-center rounded-lg border border-hairline bg-canvas/70 shadow-keycap"> <span className="h-6 w-6 rounded-pill bg-accent-blue" /> </span> <h3 className="flex-1 text-body">{c.name}</h3> <button aria-label={`Open ${c.name}`} className="flex h-9 w-9 items-center justify-center rounded-md border border-hairline text-secondary focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue">›</button> </header> <p className="mt-6 text-ui text-primary">{c.desc}</p> <hr className="my-6 border-hairline" /> <div className="min-h-0 flex-1"><Demo kind={c.demo} /></div> </article> ))} </Stagger> </div> </div> <div className="mt-10 flex items-center justify-between"> <a href="#" className="text-ui text-tertiary transition-colors duration-300 hover:text-primary">{browseLabel}</a> <div className="flex gap-4"> <button aria-label="Previous" onClick={() => scroll(-1)} className={btn}>‹</button> <button aria-label="Next" onClick={() => scroll(1)} className={btn}>›</button> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Stagger ---- 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; } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }"use client"; import { useEffect, useLayoutEffect, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useRef, useState } from "react"; type Card = { id: string; cat: string; name: string; desc: string; tint: string; glow: string; demo: "rings" | "lines" | "player" | "bars" }; const DEFAULT_CARDS: Card[] = [ { id: "a", cat: "Productivity", name: "Northwind Tasks", desc: "Capture, sort and update your to-dos without lifting your hands off the keys.", tint: "linear-gradient(138deg, rgba(32,35,91,0.7) 22%, rgba(7,9,33,0.7) 82%)", glow: "rgba(90,80,220,0.35)", demo: "rings" }, { id: "b", cat: "Productivity", name: "Altura Lingo", desc: "Convert any phrase into many languages in a single quick step.", tint: "linear-gradient(138deg, rgba(20,40,90,0.75) 22%, rgba(7,12,33,0.7) 82%)", glow: "rgba(43,94,180,0.55)", demo: "lines" }, { id: "c", cat: "Productivity", name: "Lumen Sound", desc: "Find tracks and shows, open your playlists, and manage what is playing.", tint: "linear-gradient(138deg, rgba(20,70,40,0.75) 22%, rgba(8,25,15,0.7) 82%)", glow: "rgba(30,160,80,0.55)", demo: "player" }, { id: "d", cat: "Engineering", name: "Kitefield Deploy", desc: "Ship builds, watch logs and roll back releases from one prompt.", tint: "linear-gradient(138deg, rgba(70,30,40,0.75) 22%, rgba(25,8,12,0.7) 82%)", glow: "rgba(230,80,70,0.4)", demo: "bars" }, { id: "e", cat: "Design", name: "Prism Palette", desc: "Pick shades, copy tokens and preview contrast while you work.", tint: "linear-gradient(138deg, rgba(60,30,90,0.75) 22%, rgba(18,8,33,0.7) 82%)", glow: "rgba(160,80,220,0.4)", demo: "rings" }, { id: "f", cat: "Writing", name: "Quill Notes", desc: "Draft, tidy and search your notes without opening another window.", tint: "linear-gradient(138deg, rgba(60,50,20,0.75) 22%, rgba(25,18,8,0.7) 82%)", glow: "rgba(220,170,50,0.35)", demo: "lines" }, ]; const TABS = ["Productivity", "Engineering", "Design", "Writing"]; function Demo({ kind }: { kind: Card["demo"] }) { if (kind === "rings") return ( <div className="flex h-full items-end justify-between pb-3"> {["border-dashed border-foreground", "border-foreground", "border-obsidian-accent-yellow", "border-obsidian-accent-blue bg-obsidian-accent-blue/60"].map((c, i) => ( <span key={i} className={`h-12 w-12 rounded-full border-[3px] ${c}`} /> ))} </div> ); if (kind === "lines") return ( <div className="space-y-3 overflow-hidden pt-3 text-[20px] text-foreground"> {["Warm soup of the day", "Sopa caliente del día", "Soupe chaude du jour", "Heisse Tagessuppe", "Zuppa calda oggi", "Sup panas hari ini"].map((t, i) => ( <div key={t} className={`whitespace-nowrap ${i % 2 ? "opacity-40" : ""}`}>{t}</div> ))} </div> ); if (kind === "player") return ( <div className="flex flex-col items-center gap-5 pt-3"> <div className="h-[200px] w-[200px] rounded-md bg-[linear-gradient(135deg,#ddd,#555)] shadow-obsidian-soft-glow" /> <div className="flex items-center gap-6 text-foreground"> <span>◀◀</span> <span className="flex h-10 w-10 items-center justify-center rounded-full bg-primary text-primary-foreground">▶</span> <span>▶▶</span> </div> </div> ); return ( <div className="flex h-full items-end gap-3 pb-3"> {[40, 70, 55, 90, 65, 80].map((h, i) => ( <span key={i} className="flex-1 rounded-md bg-primary/70" style={{ height: `${h}%` }} /> ))} </div> ); } export default function GradientExtensionCardCarousel({ title = "Plug in anything you use.", subtitle = "Run your everyday apps right from the launcher.", cards = DEFAULT_CARDS, browseLabel = "Explore the full catalog →", }: { title?: string; subtitle?: string; cards?: Card[]; browseLabel?: string }) { const [tab, setTab] = useState(TABS[0]); const ref = useRef<HTMLDivElement>(null); const shown = cards.filter((c) => c.cat === tab); const scroll = (d: number) => ref.current?.scrollBy({ left: d * 416, behavior: "smooth" }); const btn = "flex h-14 w-14 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-[inset_0_1px_0_rgba(255,255,255,0.1)] transition-shadow duration-300 ease-in-out hover:shadow-[inset_0_1px_1px_rgba(255,255,255,0.1),0_2px_40px_10px_rgba(154,170,255,0.05)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-obsidian-accent-blue"; return ( <section className="bg-background px-6 py-24 font-sans text-foreground md:px-[118px]"> <div className="flex flex-col justify-between gap-6 md:flex-row md:items-start"> <h2 className="max-w-sm text-obsidian-body-lg"> <span className="text-foreground">{title}</span> <br /> <span className="text-muted-foreground">{subtitle}</span> </h2> <div role="tablist" className="inline-flex self-start rounded-full border border-border bg-primary p-2 backdrop-blur-sm"> {TABS.map((t) => ( <button key={t} role="tab" aria-selected={tab === t} onClick={() => setTab(t)} className={`rounded-full px-3 py-2.5 text-obsidian-ui transition-colors duration-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-obsidian-accent-blue ${tab === t ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"}`}> {t} </button> ))} </div> </div> <div className="mt-12 [mask-image:linear-gradient(to_right,transparent,#000_64px,#000_calc(100%-64px),transparent)]"> <div ref={ref} className="overflow-x-auto px-4 py-6 [scrollbar-width:none]"> <Stagger key={tab} step={100} from="up" distance={50} className="flex gap-14"> {shown.map((c) => ( <article key={c.id} className="relative flex h-[536px] w-[360px] shrink-0 flex-col overflow-hidden rounded-2xl border border-border p-6" style={{ backgroundImage: `radial-gradient(94% 78% at 50% 30%, ${c.glow}, transparent), ${c.tint}` }}> <header className="flex items-center gap-3"> <span className="flex h-14 w-14 items-center justify-center rounded-xl border border-border bg-background/70 shadow-obsidian-keycap"> <span className="h-6 w-6 rounded-full bg-obsidian-accent-blue" /> </span> <h3 className="flex-1 text-obsidian-body">{c.name}</h3> <button aria-label={`Open ${c.name}`} className="flex h-9 w-9 items-center justify-center rounded-lg border border-border text-muted-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-obsidian-accent-blue">›</button> </header> <p className="mt-6 text-obsidian-ui text-foreground">{c.desc}</p> <hr className="my-6 border-border" /> <div className="min-h-0 flex-1"><Demo kind={c.demo} /></div> </article> ))} </Stagger> </div> </div> <div className="mt-10 flex items-center justify-between"> <a href="#" className="text-obsidian-ui text-muted-foreground transition-colors duration-300 hover:text-foreground">{browseLabel}</a> <div className="flex gap-4"> <button aria-label="Previous" onClick={() => scroll(-1)} className={btn}>‹</button> <button aria-label="Next" onClick={() => scroll(1)} className={btn}>›</button> </div> </div> </section> ); } // ---- Yoink motion (inlined, no dependencies): Stagger ---- 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; } /** Reveals each direct child one after another when the group scrolls into view. */ function Stagger({ children, step = 90, from = "up", distance = 20, duration = 650, delay = 0, once = true, as = "div", className, style, }: { children?: ReactNode; step?: number; from?: "up" | "down" | "left" | "right" | "scale" | "fade"; distance?: number; duration?: number; delay?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); useYkLayoutEffect(() => { const items = Array.from(ref.current?.children ?? []) as HTMLElement[]; if (state === "idle") return; 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.92)", fade: "none", }[from]; if (state === "hidden") { for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset }); return; } items.forEach((el, i) => { const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`; Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" }); }); // hand the children their own transitions back once everything has landed const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50); return () => clearTimeout(done); }, [state]); return ( <Tag ref={ref} className={className} style={style}> {children} </Tag> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (5 elements)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: not passedElements must meet minimum color contrast ratio thresholds (3 elements)
- 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.