Framework Icon Tab Code Panel
Bordered panel with a row of six icon-only framework tabs along the top and a syntax-highlighted code block below (violet keywords, amber strings, green identifiers, grey punctuation), plus a small pill 'Read docs' link anchored bottom-right. Heading to the left with muted lead-in and dark framework name.
Rebuilt from supabase.com in the Emerald Paper Precision style.
Looks exactly like supabase.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: lead (heading lead-in) and docsLabel (pill text prefix). Click an icon tab to swap the heading word and code with a 150ms fade.
components/framework-code-tabs.tsx
import { useState } from "react"; type Tok = [string, string]; type Line = Tok[]; type Tab = { id: string; label: string; word: string; docs: string; lines: Line[] }; const K = "text-violet-code"; const S = "text-amber-code"; const I = "text-brand-deep"; const P = "text-ink-faint"; const T = "text-ink-soft"; const makeLines = (fn: string, call: string): Line[] => [ [[K, "import"], [P, " { "], [T, "createStore"], [P, " } "], [K, "from"], [T, " "], [S, "'@acme/store-js'"]], [], [[K, "const"], [T, " store "], [P, "= "], [I, "createStore"], [P, "("]], [[T, " process"], [P, "."], [T, "env"], [P, "."], [I, "STORE_URL"], [P, ","]], [[T, " process"], [P, "."], [T, "env"], [P, "."], [I, "STORE_KEY"]], [[P, ")"]], [], [[K, "export default function"], [T, " "], [I, fn], [P, "() {"]], [[T, " "], [K, "const"], [P, " ["], [T, "items, setItems"], [P, "] = "], [I, call], [P, "([])"]], [], [[T, " "], [I, "return"], [P, " <"], [I, "ItemList"], [T, " items"], [P, "={"], [T, "items"], [P, "} />"]], [[P, "}"]], ]; const TABS: Tab[] = [ { id: "a", label: "Circle", word: "Atlas", docs: "Atlas", lines: makeLines("App", "useState") }, { id: "b", label: "Square", word: "Beacon", docs: "Beacon", lines: makeLines("Page", "ref") }, { id: "c", label: "Triangle", word: "Cobalt", docs: "Cobalt", lines: makeLines("Home", "signal") }, { id: "d", label: "Diamond", word: "Delta", docs: "Delta", lines: makeLines("Main", "writable") }, { id: "e", label: "Hexagon", word: "Ember", docs: "Ember", lines: makeLines("Root", "useList") }, { id: "f", label: "Cross", word: "Fjord", docs: "Fjord", lines: makeLines("View", "createSignal") }, ]; function Icon({ i }: { i: number }) { const c = { fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinejoin: "round" as const }; const shapes = [ <circle key="0" cx="12" cy="12" r="8" {...c} />, <rect key="1" x="4" y="4" width="16" height="16" rx="3" {...c} />, <path key="2" d="M12 4 21 20H3z" {...c} />, <path key="3" d="M12 3 21 12 12 21 3 12z" {...c} />, <path key="4" d="M12 3 20 7.5v9L12 21 4 16.5v-9z" {...c} />, <path key="5" d="M12 4v16M4 12h16" {...c} />, ]; return <svg width="22" height="22" viewBox="0 0 24 24" aria-hidden="true">{shapes[i]}</svg>; } export default function FrameworkIconTabCodePanel({ lead = "Build faster with", docsLabel = "Read docs for" }: { lead?: string; docsLabel?: string }) { const [active, setActive] = useState(0); const [shown, setShown] = useState(0); const [visible, setVisible] = useState(true); const select = (i: number) => { if (i === active) return; setActive(i); setVisible(false); setTimeout(() => { setShown(i); setVisible(true); }, 150); }; const tab = TABS[shown]; return ( <section className="bg-canvas px-6 py-20"> <div className="mx-auto grid max-w-6xl gap-10 lg:grid-cols-[1fr_544px]"> <h2 className="font-display text-h2 tracking-[-0.02em]"> <span className="block text-ink-muted">{lead}</span> <span className={"block text-ink transition-opacity duration-150 " + (visible ? "opacity-100" : "opacity-0")}>{tab.word}</span> </h2> <div className="overflow-hidden rounded-lg border border-hairline bg-surface"> <div role="tablist" className="grid grid-cols-6 border-b border-hairline"> {TABS.map((t, i) => ( <button key={t.id} role="tab" aria-selected={active === i} aria-label={t.label} onClick={() => select(i)} className={"flex h-[60px] items-center justify-center border-r border-hairline transition-colors duration-hover-color last:border-r-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand " + (active === i ? "bg-surface-muted text-ink" : "text-ink-muted hover:text-brand")} > <Icon i={i} /> </button> ))} </div> <div className="relative p-6 pb-16"> <pre className={"overflow-x-auto font-mono text-[13px] leading-[22px] transition-opacity duration-150 " + (visible ? "opacity-100" : "opacity-0")}> <code> {tab.lines.map((line, li) => ( <div key={li} className="min-h-[22px] whitespace-pre"> {line.map((tk, ti) => ( <span key={ti} className={tk[0]}>{tk[1]}</span> ))} </div> ))} </code> </pre> <a href="#" className="absolute bottom-4 right-4 inline-flex items-center gap-2 rounded-pill border border-hairline bg-surface px-3 py-1.5 text-caption text-ink transition-colors duration-hover-color hover:border-hairline-strong focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand" > {docsLabel} {tab.docs} <svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M2 8 8 2M3 2h5v5" fill="none" stroke="currentColor" strokeWidth="1.2" /></svg> </a> </div> </div> </div> </section> ); }import { useState } from "react"; type Tok = [string, string]; type Line = Tok[]; type Tab = { id: string; label: string; word: string; docs: string; lines: Line[] }; const K = "text-emerald-violet-code"; const S = "text-emerald-amber-code"; const I = "text-primary/90"; const P = "text-muted-foreground"; const T = "text-muted-foreground"; const makeLines = (fn: string, call: string): Line[] => [ [[K, "import"], [P, " { "], [T, "createStore"], [P, " } "], [K, "from"], [T, " "], [S, "'@acme/store-js'"]], [], [[K, "const"], [T, " store "], [P, "= "], [I, "createStore"], [P, "("]], [[T, " process"], [P, "."], [T, "env"], [P, "."], [I, "STORE_URL"], [P, ","]], [[T, " process"], [P, "."], [T, "env"], [P, "."], [I, "STORE_KEY"]], [[P, ")"]], [], [[K, "export default function"], [T, " "], [I, fn], [P, "() {"]], [[T, " "], [K, "const"], [P, " ["], [T, "items, setItems"], [P, "] = "], [I, call], [P, "([])"]], [], [[T, " "], [I, "return"], [P, " <"], [I, "ItemList"], [T, " items"], [P, "={"], [T, "items"], [P, "} />"]], [[P, "}"]], ]; const TABS: Tab[] = [ { id: "a", label: "Circle", word: "Atlas", docs: "Atlas", lines: makeLines("App", "useState") }, { id: "b", label: "Square", word: "Beacon", docs: "Beacon", lines: makeLines("Page", "ref") }, { id: "c", label: "Triangle", word: "Cobalt", docs: "Cobalt", lines: makeLines("Home", "signal") }, { id: "d", label: "Diamond", word: "Delta", docs: "Delta", lines: makeLines("Main", "writable") }, { id: "e", label: "Hexagon", word: "Ember", docs: "Ember", lines: makeLines("Root", "useList") }, { id: "f", label: "Cross", word: "Fjord", docs: "Fjord", lines: makeLines("View", "createSignal") }, ]; function Icon({ i }: { i: number }) { const c = { fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinejoin: "round" as const }; const shapes = [ <circle key="0" cx="12" cy="12" r="8" {...c} />, <rect key="1" x="4" y="4" width="16" height="16" rx="3" {...c} />, <path key="2" d="M12 4 21 20H3z" {...c} />, <path key="3" d="M12 3 21 12 12 21 3 12z" {...c} />, <path key="4" d="M12 3 20 7.5v9L12 21 4 16.5v-9z" {...c} />, <path key="5" d="M12 4v16M4 12h16" {...c} />, ]; return <svg width="22" height="22" viewBox="0 0 24 24" aria-hidden="true">{shapes[i]}</svg>; } export default function FrameworkIconTabCodePanel({ lead = "Build faster with", docsLabel = "Read docs for" }: { lead?: string; docsLabel?: string }) { const [active, setActive] = useState(0); const [shown, setShown] = useState(0); const [visible, setVisible] = useState(true); const select = (i: number) => { if (i === active) return; setActive(i); setVisible(false); setTimeout(() => { setShown(i); setVisible(true); }, 150); }; const tab = TABS[shown]; return ( <section className="bg-background px-6 py-20"> <div className="mx-auto grid max-w-6xl gap-10 lg:grid-cols-[1fr_544px]"> <h2 className="font-sans text-emerald-h2 tracking-[-0.02em]"> <span className="block text-muted-foreground">{lead}</span> <span className={"block text-foreground transition-opacity duration-150 " + (visible ? "opacity-100" : "opacity-0")}>{tab.word}</span> </h2> <div className="overflow-hidden rounded-lg border border-border bg-card"> <div role="tablist" className="grid grid-cols-6 border-b border-border"> {TABS.map((t, i) => ( <button key={t.id} role="tab" aria-selected={active === i} aria-label={t.label} onClick={() => select(i)} className={"flex h-[60px] items-center justify-center border-r border-border transition-colors duration-emerald-hover-color last:border-r-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary " + (active === i ? "bg-muted text-foreground" : "text-muted-foreground hover:text-primary")} > <Icon i={i} /> </button> ))} </div> <div className="relative p-6 pb-16"> <pre className={"overflow-x-auto font-mono text-[13px] leading-[22px] transition-opacity duration-150 " + (visible ? "opacity-100" : "opacity-0")}> <code> {tab.lines.map((line, li) => ( <div key={li} className="min-h-[22px] whitespace-pre"> {line.map((tk, ti) => ( <span key={ti} className={tk[0]}>{tk[1]}</span> ))} </div> ))} </code> </pre> <a href="#" className="absolute bottom-4 right-4 inline-flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 text-emerald-caption text-foreground transition-colors duration-emerald-hover-color hover:border-border focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" > {docsLabel} {tab.docs} <svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M2 8 8 2M3 2h5v5" fill="none" stroke="currentColor" strokeWidth="1.2" /></svg> </a> </div> </div> </div> </section> ); }
Quality checks
Automated, in a real browser · 4d ago- Accessible: not passedElements must meet minimum color contrast ratio thresholds (3 elements)Scrollable region must have keyboard access (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 (6 elements)
- 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.