Detailed Header

A comprehensive header component with navigation, search, notifications panel, and user dropdown menu. Perfect for SaaS dashboards and admin interfaces.

SearchNotificationsUser MenuActive States

Installation

Terminal
ReactTailwind
TSX
npx @uiblox/cli add detailed-header

Preview

Brand

Source Code

detailed-header.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
"use client"; import { useState } from "react"; import Link from "next/link"; import { cn } from "@/lib/utils"; export function DetailedHeader() { const [searchOpen, setSearchOpen] = useState(false); const [notificationsOpen, setNotificationsOpen] = useState(false); const [userMenuOpen, setUserMenuOpen] = useState(false); const notifications = [ { id: 1, title: "New comment", message: "John commented on your post", time: "5m ago", unread: true }, { id: 2, title: "Project update", message: "Design system v2.0 released", time: "1h ago", unread: true }, { id: 3, title: "Meeting reminder", message: "Team standup in 30 minutes", time: "2h ago", unread: false }, ]; return ( <header className="bg-white dark:bg-slate-900 border-b border-slate-200 dark:border-slate-800 sticky top-0 z-50"> <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div className="flex items-center justify-between h-16"> {/* Left: Logo + Navigation */} <div className="flex items-center gap-8"> <Link href="/" className="flex items-center gap-2"> <div className="w-8 h-8 rounded-lg bg-gradient-to-br from-purple-500 to-indigo-600" /> <span className="text-xl font-bold text-slate-900 dark:text-white hidden sm:block">Brand</span> </Link> <nav className="hidden lg:flex items-center gap-1"> <Link href="/dashboard" className="px-3 py-2 text-sm font-medium text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900/20 rounded-lg"> Dashboard </Link> <Link href="/projects" className="px-3 py-2 text-sm font-medium text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-white hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors"> Projects </Link> <Link href="/team" className="px-3 py-2 text-sm font-medium text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-white hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors"> Team </Link> <Link href="/reports" className="px-3 py-2 text-sm font-medium text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-white hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors"> Reports </Link> </nav> </div> {/* Right: Search + Notifications + User */} <div className="flex items-center gap-2"> {/* Search */} <div className="relative"> <button onClick={() => setSearchOpen(!searchOpen)} className="p-2 text-slate-500 hover:text-slate-900 dark:hover:text-white hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors" > <SearchIcon /> </button> {searchOpen && ( <div className="absolute right-0 top-full mt-2 w-80 bg-white dark:bg-slate-900 rounded-xl shadow-lg border border-slate-200 dark:border-slate-700 p-2"> <input type="text" placeholder="Search..." autoFocus className="w-full px-4 py-2 bg-slate-100 dark:bg-slate-800 rounded-lg text-sm outline-none focus:ring-2 focus:ring-purple-500" /> </div> )} </div> {/* Notifications */} <div className="relative"> <button onClick={() => setNotificationsOpen(!notificationsOpen)} className="relative p-2 text-slate-500 hover:text-slate-900 dark:hover:text-white hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors" > <BellIcon /> <span className="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full" /> </button> {notificationsOpen && ( <div className="absolute right-0 top-full mt-2 w-80 bg-white dark:bg-slate-900 rounded-xl shadow-lg border border-slate-200 dark:border-slate-700 overflow-hidden"> <div className="px-4 py-3 border-b border-slate-200 dark:border-slate-700 flex items-center justify-between"> <span className="font-semibold text-slate-900 dark:text-white">Notifications</span> <button className="text-sm text-purple-600 hover:text-purple-700">Mark all read</button> </div> <div className="max-h-80 overflow-y-auto"> {notifications.map((n) => ( <div key={n.id} className={cn("px-4 py-3 hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer", n.unread && "bg-purple-50/50 dark:bg-purple-900/10")}> <p className="text-sm font-medium text-slate-900 dark:text-white">{n.title}</p> <p className="text-xs text-slate-500 mt-0.5">{n.message}</p> <p className="text-xs text-slate-400 mt-1">{n.time}</p> </div> ))} </div> </div> )} </div> {/* User Menu */} <div className="relative"> <button onClick={() => setUserMenuOpen(!userMenuOpen)} className="flex items-center gap-2 p-1.5 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg transition-colors" > <div className="w-8 h-8 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center text-white text-sm font-semibold"> JD </div> <ChevronDownIcon className="w-4 h-4 text-slate-400 hidden sm:block" /> </button> {userMenuOpen && ( <div className="absolute right-0 top-full mt-2 w-56 bg-white dark:bg-slate-900 rounded-xl shadow-lg border border-slate-200 dark:border-slate-700 py-1"> <div className="px-4 py-3 border-b border-slate-200 dark:border-slate-700"> <p className="text-sm font-medium text-slate-900 dark:text-white">Jane Doe</p> <p className="text-xs text-slate-500">jane@example.com</p> </div> <Link href="/profile" className="block px-4 py-2 text-sm text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-800">Profile</Link> <Link href="/settings" className="block px-4 py-2 text-sm text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-800">Settings</Link> <div className="border-t border-slate-200 dark:border-slate-700 mt-1 pt-1"> <button className="block w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20">Sign out</button> </div> </div> )} </div> </div> </div> </div> </header> ); } function SearchIcon() { return <svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>; } function BellIcon() { return <svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" /></svg>; } function ChevronDownIcon({ className }: { className?: string }) { return <svg className={className} fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" /></svg>; }