Gradient Product Search Bar
A white rounded toolbar floating over a vivid orange-purple silk gradient banner. It contains a search field with magnifier icon and two select dropdowns (Use case, Product area).
Rebuilt from stripe.com/products in the Iridescent Ledger style.
npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/blocks/product-filter-bar.json
Looks exactly like stripe.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/mine/product-filter-bar.json
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: headline, subline, placeholder, useCases, areas, and onChange({query, useCase, area}) to filter a catalog below. Renders standalone with defaults; fields show an accent focus ring.
components/product-filter-bar.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useState } from "react"; type Props = { headline?: string; subline?: string; placeholder?: string; useCases?: string[]; areas?: string[]; onChange?: (v: { query: string; useCase: string; area: string }) => void; }; const Chevron = () => ( <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" className="pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 text-ink"> <path d="M2.5 4.5 6 8l3.5-3.5" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" /> </svg> ); export default function GradientProductSearchBar({ headline = "Browse the whole catalog.", subline = "Find tools for billing, invoicing, treasury, reporting, and everything in between.", placeholder = "Search for a product", useCases = ["Accept payments", "Send invoices", "Manage cash", "Analyze data"], areas = ["Billing", "Treasury", "Reporting", "Compliance"], onChange, }: Props) { const [query, setQuery] = useState(""); const [useCase, setUseCase] = useState(""); const [area, setArea] = useState(""); const update = (q: string, u: string, a: string) => { setQuery(q); setUseCase(u); setArea(a); onChange?.({ query: q, useCase: u, area: a }); }; const field = "h-12 w-full rounded-sm border border-hairline bg-surface text-ui text-ink outline-none transition-shadow duration-link ease-link focus:border-accent focus:ring-2 focus:ring-accent/40"; return ( <section className="relative isolate overflow-hidden bg-night px-4 py-20 sm:py-24"> <div aria-hidden="true" className="absolute inset-0 -z-10 bg-[linear-gradient(115deg,var(--color-signal-orange)_0%,var(--color-signal-orange)_18%,var(--color-signal-magenta)_32%,var(--color-accent)_55%,var(--color-accent-soft)_100%)]" /> <div aria-hidden="true" className="absolute -left-20 top-0 -z-10 h-[140%] w-40 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.18),transparent)] blur-xl" /> <div aria-hidden="true" className="absolute left-1/3 top-0 -z-10 h-[140%] w-56 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.14),transparent)] blur-2xl" /> <div aria-hidden="true" className="absolute left-2/3 top-0 -z-10 h-[140%] w-40 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(30,10,120,0.25),transparent)] blur-2xl" /> <div className="mx-auto max-w-[1234px]"> <Reveal from="up"> <p className="mx-auto max-w-[780px] text-center font-display text-3xl font-light leading-tight tracking-[-0.02em] text-white sm:text-4xl"> <span className="text-white">{headline}</span>{" "} <span className="text-white/70">{subline}</span> </p> </Reveal> <Reveal from="up" delay={120}> <form role="search" onSubmit={(e) => e.preventDefault()} className="mt-12 grid gap-2 rounded-md bg-surface p-4 shadow-floating md:grid-cols-[2fr_1fr_1fr]"> <div className="relative"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" className="pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 text-ink-faint"> <circle cx="7" cy="7" r="5" stroke="currentColor" strokeWidth="1.4" /> <path d="m11 11 3 3" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" /> </svg> <input type="search" aria-label="Search products" placeholder={placeholder} value={query} onChange={(e) => update(e.target.value, useCase, area)} className={`${field} pl-11 pr-4 placeholder:text-ink-faint`} /> </div> <div className="relative"> <select aria-label="Use case" value={useCase} onChange={(e) => update(query, e.target.value, area)} className={`${field} cursor-pointer appearance-none px-4 pr-10 font-medium`}> <option value="">Use case</option> {useCases.map((u) => (<option key={u} value={u}>{u}</option>))} </select> <Chevron /> </div> <div className="relative"> <select aria-label="Product area" value={area} onChange={(e) => update(query, useCase, e.target.value)} className={`${field} cursor-pointer appearance-none px-4 pr-10 font-medium`}> <option value="">Product area</option> {areas.map((a) => (<option key={a} value={a}>{a}</option>))} </select> <Chevron /> </div> </form> </Reveal> </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 Props = { headline?: string; subline?: string; placeholder?: string; useCases?: string[]; areas?: string[]; onChange?: (v: { query: string; useCase: string; area: string }) => void; }; const Chevron = () => ( <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" className="pointer-events-none absolute right-4 top-1/2 -translate-y-1/2 text-foreground"> <path d="M2.5 4.5 6 8l3.5-3.5" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" /> </svg> ); export default function GradientProductSearchBar({ headline = "Browse the whole catalog.", subline = "Find tools for billing, invoicing, treasury, reporting, and everything in between.", placeholder = "Search for a product", useCases = ["Accept payments", "Send invoices", "Manage cash", "Analyze data"], areas = ["Billing", "Treasury", "Reporting", "Compliance"], onChange, }: Props) { const [query, setQuery] = useState(""); const [useCase, setUseCase] = useState(""); const [area, setArea] = useState(""); const update = (q: string, u: string, a: string) => { setQuery(q); setUseCase(u); setArea(a); onChange?.({ query: q, useCase: u, area: a }); }; const field = "h-12 w-full rounded-sm border border-border bg-card text-iridescent-ui text-foreground outline-none transition-shadow duration-iridescent-link ease-iridescent-link focus:border-primary focus:ring-2 focus:ring-primary/40"; return ( <section className="relative isolate overflow-hidden bg-foreground px-4 py-20 sm:py-24"> <div aria-hidden="true" className="absolute inset-0 -z-10 bg-[linear-gradient(115deg,var(--color-iridescent-signal-orange)_0%,var(--color-iridescent-signal-orange)_18%,var(--color-iridescent-signal-magenta)_32%,var(--color-primary)_55%,var(--color-iridescent-accent-soft)_100%)]" /> <div aria-hidden="true" className="absolute -left-20 top-0 -z-10 h-[140%] w-40 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.18),transparent)] blur-xl" /> <div aria-hidden="true" className="absolute left-1/3 top-0 -z-10 h-[140%] w-56 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(255,255,255,0.14),transparent)] blur-2xl" /> <div aria-hidden="true" className="absolute left-2/3 top-0 -z-10 h-[140%] w-40 rotate-[28deg] bg-[linear-gradient(90deg,transparent,rgba(30,10,120,0.25),transparent)] blur-2xl" /> <div className="mx-auto max-w-[1234px]"> <Reveal from="up"> <p className="mx-auto max-w-[780px] text-center font-sans text-3xl font-light leading-tight tracking-[-0.02em] text-background sm:text-4xl"> <span className="text-background">{headline}</span>{" "} <span className="text-background/70">{subline}</span> </p> </Reveal> <Reveal from="up" delay={120}> <form role="search" onSubmit={(e) => e.preventDefault()} className="mt-12 grid gap-2 rounded-md bg-card p-4 shadow-iridescent-floating md:grid-cols-[2fr_1fr_1fr]"> <div className="relative"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" className="pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground"> <circle cx="7" cy="7" r="5" stroke="currentColor" strokeWidth="1.4" /> <path d="m11 11 3 3" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" /> </svg> <input type="search" aria-label="Search products" placeholder={placeholder} value={query} onChange={(e) => update(e.target.value, useCase, area)} className={`${field} pl-11 pr-4 placeholder:text-muted-foreground`} /> </div> <div className="relative"> <select aria-label="Use case" value={useCase} onChange={(e) => update(query, e.target.value, area)} className={`${field} cursor-pointer appearance-none px-4 pr-10 font-medium`}> <option value="">Use case</option> {useCases.map((u) => (<option key={u} value={u}>{u}</option>))} </select> <Chevron /> </div> <div className="relative"> <select aria-label="Product area" value={area} onChange={(e) => update(query, useCase, e.target.value)} className={`${field} cursor-pointer appearance-none px-4 pr-10 font-medium`}> <option value="">Product area</option> {areas.map((a) => (<option key={a} value={a}>{a}</option>))} </select> <Chevron /> </div> </form> </Reveal> </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: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- 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.