Headers & navigation / Tab bars
Sticky Pill Sub-Navigation
A white pill-shaped floating bar with soft shadow, holding in-page anchors (Standard pricing, Custom pricing, FAQs). It centers near the bottom of the hero and then pins to the top when scrolling.
Rebuilt from stripe.com/pricing in the Iridescent Ledger style.
npx shadcn@latest add https://justyoink.it/r/iridescent-ledger/blocks/capsule-subnav.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/capsule-subnav.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
Pass `items` (id + label) matching your section ids, `defaultActive`, and `pinOffset` (scroll px before the bar pins to the top). Clicking an anchor tints it with the accent pill.
components/capsule-subnav.tsx
import { useEffect, useState } from "react"; type Item = { id: string; label: string }; export default function StickySubNav({ items = [ { id: "standard", label: "Standard pricing" }, { id: "custom", label: "Custom pricing" }, { id: "faqs", label: "FAQs" }, ], defaultActive = "standard", pinOffset = 240, }: { items?: Item[]; defaultActive?: string; pinOffset?: number; }) { const [active, setActive] = useState(defaultActive); const [pinned, setPinned] = useState(false); useEffect(() => { const onScroll = () => setPinned(window.scrollY > pinOffset); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, [pinOffset]); return ( <div className={pinned ? "fixed inset-x-0 top-3 z-50 flex justify-center px-4" : "relative flex justify-center px-4 py-6"}> <nav aria-label="On this page" className={"flex items-center gap-1 rounded-pill bg-surface p-1.5 shadow-floating transition-all duration-[250ms] ease-smooth motion-reduce:transition-none " + (pinned ? "animate-[none] translate-y-0 opacity-100" : "")} > {items.map((it) => { const on = active === it.id; return ( <a key={it.id} href={"#" + it.id} aria-current={on ? "true" : undefined} onClick={() => setActive(it.id)} className={"rounded-pill px-4 py-2 text-ui font-medium transition-colors duration-link ease-link focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent " + (on ? "bg-accent-soft text-ink-deep" : "text-ink hover:bg-accent-wash")} > {it.label} </a> ); })} </nav> </div> ); }import { useEffect, useState } from "react"; type Item = { id: string; label: string }; export default function StickySubNav({ items = [ { id: "standard", label: "Standard pricing" }, { id: "custom", label: "Custom pricing" }, { id: "faqs", label: "FAQs" }, ], defaultActive = "standard", pinOffset = 240, }: { items?: Item[]; defaultActive?: string; pinOffset?: number; }) { const [active, setActive] = useState(defaultActive); const [pinned, setPinned] = useState(false); useEffect(() => { const onScroll = () => setPinned(window.scrollY > pinOffset); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, [pinOffset]); return ( <div className={pinned ? "fixed inset-x-0 top-3 z-50 flex justify-center px-4" : "relative flex justify-center px-4 py-6"}> <nav aria-label="On this page" className={"flex items-center gap-1 rounded-full bg-card p-1.5 shadow-iridescent-floating transition-all duration-[250ms] ease-iridescent-smooth motion-reduce:transition-none " + (pinned ? "animate-[none] translate-y-0 opacity-100" : "")} > {items.map((it) => { const on = active === it.id; return ( <a key={it.id} href={"#" + it.id} aria-current={on ? "true" : undefined} onClick={() => setActive(it.id)} className={"rounded-full px-4 py-2 text-iridescent-ui font-medium transition-colors duration-iridescent-link ease-iridescent-link focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary " + (on ? "bg-iridescent-accent-soft text-muted-foreground" : "text-foreground hover:bg-primary/10")} > {it.label} </a> ); })} </nav> </div> ); }
Quality checks
Automated, in a real browser · 5d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: not passedElements must meet minimum color contrast ratio thresholds (1 element)
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: doesn't applyDoesn't animate, so there's nothing to check.