BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/uifoundry/header-menu-button

Header Menu Button

uifoundry/header-menu-button
FreeBlock

Customizable button component for headers with authentication and navigation support

Live preview

live · rendered by the registry
Rendered by uifoundry on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://uifoundry.dev/r/header-menu-button.json

Source

registry/payload/blocks/header-menu-button/index.tsxuifoundry.dev/r/header-menu-button.json
1"use client";
2
3import Link from "next/link";
4import type { HeaderMenuButtonBlock } from "~/payload-types";
5import { useSession } from "~/auth/client";
6import { cn } from "@/registry/deafult/utils";
7import UserAvatar from "@/registry/default/components/UserAvatar";
8
9export default function MenuButton({
10 mobileView = false,
11 label,
12 href = "",
13 targetBlank,
14 alignment,
15 auth,
16}: { mobileView?: boolean } & HeaderMenuButtonBlock) {
17 const { data: session } = useSession();
18 if (auth) {
19 if (!session?.user) {
20 return (
21 <div
22 className={cn(
23 alignment === "left"
24 ? "self-start"
25 : alignment === "right"
26 ? "self-end"
27 : "self-center",
28 mobileView === true && "hidden",
29 )}
30 >
31 <Link href="/auth/sign-in" className="cursor-pointer">
32 {label}
33 </Link>
34 </div>
35 );
36 }
37
38 return (
39 <div className="flex">
40 <UserAvatar />
41 </div>
42 );
43 }
44
45 return (
46 <div
47 className={cn(
48 alignment === "left"
49 ? "self-start"
50 : alignment === "right"
51 ? "self-end"
52 : "self-center",
53 mobileView === true && "hidden",
54 )}
55 >
56 <Link
57 target={targetBlank ? "_blank" : "_self"}
58 href={href ?? "/home"}
59 className="cursor-pointer"
60 >
61 {label}
62 </Link>
63 </div>
64 );
65}

What it pulls in

npm packages

  • react
  • next
  • payload

Other registry items

  • @uifoundry/style-utils
  • @uifoundry/select-enum-field
  • @uifoundry/user-avatar

Files it writes

  • registry/payload/blocks/header-menu-button/config.ts
  • registry/payload/blocks/header-menu-button/index.tsx

Facts

Registry
uifoundry
Type
registry:block
Access
Free
Files written
2
Licence
NOASSERTION
First indexed
2026-08-01
Last confirmed
2 days ago

Go to the source

Docs on uifoundry uifoundry.dev UIFoundry/uifoundry on GitHub Raw registry item This item as JSON

More from uifoundry

All 54 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Color Fieldcolor-fielduifoundryBlocksFree4 deps · 2 files
Coming Soon 1coming-soon-1uifoundryBlocksFree3 deps · 2 files
CTA 1cta-1uifoundryBlocksFree3 deps · 2 files
CTA 2cta-2uifoundryBlocksFree3 deps · 2 files
CTA 3cta-3uifoundryBlocksFree3 deps · 2 files
Custom Headercustom-headeruifoundryBlocksFree4 deps · 3 files
Features 1features-1uifoundryBlocksFree3 deps · 2 files
Features 2features-2uifoundryBlocksFree4 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex