Public Header
tdds/public-headerFreeBlock
Public-facing header with government banner, navigation bar, and command palette search (Cmd+K)
Install it
npx shadcn@latest add https://raw.githubusercontent.com/gjohnsx/ttb-label-verification/main/tdds-registry/public/r/public-header.jsonSource
1"use client"23import { useEffect, useState } from "react"4import Link from "next/link"5import { useRouter } from "next/navigation"6import {7 Search,8 ExternalLink,9 FileText,10 Twitter,11 Github,12 Linkedin,13 Home,14 LayoutGrid,15 type LucideIcon,16} from "lucide-react"17import { GovBanner } from "@/registry/ui/gov-banner"18import {19 CommandDialog,20 Command,21 CommandEmpty,22 CommandGroup,23 CommandInput,24 CommandItem,25 CommandList,26 CommandSeparator,27} from "@/registry/ui/command"2829// Types30export interface NavLink {31 label: string32 href: string33 external?: boolean34}3536export interface CommandItemType {37 label: string38 icon?: LucideIcon39 href?: string40 action?: () => void41 external?: boolean42}4344export interface CommandGroupType {45 heading: string46 items: CommandItemType[]47}4849const DEFAULT_NAV_LINKS: NavLink[] = [50 { label: "COMPONENTS", href: "/demo", external: false },51 { label: "CV", href: "https://www.gregjohns.dev", external: true },52 { label: "GITHUB", href: "https://github.com/gjohnsx", external: true },53 { label: "LINKEDIN", href: "https://linkedin.com/in/greg-johns", external: true },54 { label: "X", href: "https://x.com/gjohnsx", external: true },55]5657interface PublicHeaderProps {58 title?: string59 logoSrc?: string60 logoAlt?: string61 homeHref?: string62 navLinks?: NavLink[]63 commandGroups?: CommandGroupType[]64}6566export function PublicHeader({67 title = "TTB Label Verification",68 logoSrc = "/logo/app-seal/treasury.png",69 logoAlt = "Treasury",70 homeHref = "/",71 navLinks = DEFAULT_NAV_LINKS,72 commandGroups,73}: PublicHeaderProps) {74 const [open, setOpen] = useState(false)75 const router = useRouter()7677 useEffect(() => {78 const down = (e: KeyboardEvent) => {79 if (e.key === "k" && (e.metaKey || e.ctrlKey)) {80 e.preventDefault()81 setOpen((open) => !open)82 }83 }8485 document.addEventListener("keydown", down)86 return () => document.removeEventListener("keydown", down)87 }, [])8889 const runCommand = (command: () => void) => {90 setOpen(false)91 command()92 }9394 // Default command groups if not provided95 const defaultCommandGroups: CommandGroupType[] = [96 {97 heading: "Navigation",98 items: [99 {100 label: "Home",101 icon: Home,102 action: () => router.push(homeHref),103 },104 {105 label: "Components",106 icon: LayoutGrid,107 action: () => router.push("/demo"),108 },109 ],110 },111 {112// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from tdds
All 43 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| App Headerapp-header | tdds | Blocks | Free | 1 dep · 2 files | |
| Advanced Data Tabledata-table-advanced | tdds | Blocks | Free | 1 dep · 10 files |
