Header Component
clerk/nextjs-headerFreeComponent
A header component with Clerk authentication buttons and user button.
Install it
npx shadcn@latest add https://clerk.com/r/nextjs-header.jsonSource
1import { Button } from '@/components/ui/button';2import { Show, SignInButton, SignUpButton, UserButton } from '@clerk/nextjs';3import Link from 'next/link';45export function Header() {6 return (7 <header className='flex h-16 items-center justify-between gap-4 border-b px-4'>8 <Link9 href='/'10 className='flex items-center gap-x-4'11 >12 <svg13 fill='none'14 viewBox='0 0 44 44'15 className='size-9'16 aria-hidden17 >18 <path19 fill='currentColor'20 d='M38 0a6 6 0 0 1 6 6v32a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6V6a6 6 0 0 1 6-6h32ZM22.982 9.105c-.208-1.081-1.756-1.081-1.964 0l-.85 4.421a1 1 0 0 1-1.666.541l-3.287-3.077c-.804-.752-2.056.158-1.589 1.155l1.911 4.077a1 1 0 0 1-1.03 1.417l-4.467-.558c-1.093-.136-1.571 1.336-.607 1.868l3.942 2.175a1 1 0 0 1 0 1.752l-3.942 2.175c-.964.532-.486 2.004.607 1.868l4.468-.558a1 1 0 0 1 1.03 1.417l-1.912 4.077c-.467.997.785 1.907 1.589 1.155l3.287-3.077a1 1 0 0 1 1.666.54l.85 4.422c.208 1.081 1.756 1.081 1.964 0l.85-4.421a1 1 0 0 1 1.666-.541l3.287 3.077c.804.752 2.056-.158 1.589-1.155l-1.911-4.077a1 1 0 0 1 1.03-1.417l4.467.558c1.093.136 1.572-1.336.607-1.868l-3.942-2.175a1 1 0 0 1 0-1.752l3.942-2.175c.965-.532.486-2.004-.607-1.868l-4.468.558a1 1 0 0 1-1.03-1.417l1.912-4.077c.467-.997-.785-1.907-1.589-1.155l-3.287 3.077a1 1 0 0 1-1.666-.54l-.85-4.422Z'21 />22 </svg>23 <span className='font-semibold'>Acme Co.</span>24 </Link>25 <div className='flex items-center gap-x-4'>26 <Show when='signed-out'>27 <SignInButton>28 <Button variant='ghost'>Sign in</Button>29 </SignInButton>30 <SignUpButton>31 <Button>Sign up</Button>32 </SignUpButton>33 </Show>34 <Show when='signed-in'>35 <UserButton />36 </Show>37 </div>38 </header>39 );40}
What it pulls in
npm packages
Other registry items
Files it writes
More from clerk
All 12 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Clerk Provider (App Router)nextjs-clerk-provider | clerk | Components | Free | 2 deps | |
| Theme Providernextjs-theme-provider | clerk | Components | Free | 1 dep |
