Radial Menu
Circular clip-path fullscreen navigation.
RADIAL MENU
Click the corner button to toggle the radial clip-path menu.
1. Install Dependencies
$npm install framer-motion lucide-react
2. Copy Component Code
components/ui/RadialMenu.tsx
1"use client";2
3import React, { useState } from "react";4import { AnimatePresence, motion, useReducedMotion } from "framer-motion";5import { Menu, X } from "lucide-react";6
7interface RadialLink {8 label: string;9 href: string;10 index: string;11}12
13interface RadialMenuProps {14 links: RadialLink[];15}16
17export function RadialMenu({ links }: RadialMenuProps) {18 const [open, setOpen] = useState(false);19 const prefersReducedMotion = useReducedMotion();20
21 return (22 <div className="relative h-72 w-full overflow-hidden rounded-2xl border border-black/[0.08] bg-white p-5 dark:border-white/[0.08] dark:bg-[#0A0A0A]">23 <div className="relative z-20 flex items-center justify-between">24 <span className="font-mono text-xs text-neutral-500 dark:text-neutral-400">25 RADIAL NAV26 </span>27 <button28 type="button"29 onClick={() => setOpen((prev) => !prev)}30 aria-expanded={open}31 aria-label={open ? "Close menu" : "Open menu"}32 className="inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.12] bg-white text-black dark:border-white/[0.14] dark:bg-black dark:text-white"33 >34 {open ? <X className="h-4 w-4" /> : <Menu className="h-4 w-4" />}35 </button>36 </div>37
38 <AnimatePresence>39 {open && (40 <motion.nav41 initial={42 prefersReducedMotion43 ? { opacity: 0 }44 : { clipPath: "circle(0% at calc(100% - 32px) 32px)" }45 }46 animate={47 prefersReducedMotion48 ? { opacity: 1 }49 : {50 clipPath: "circle(150% at calc(100% - 32px) 32px)",51 transition: { duration: 0.55, ease: [0.76, 0, 0.24, 1] },52 }53 }54 exit={55 prefersReducedMotion56 ? { opacity: 0 }57 : {58 clipPath: "circle(0% at calc(100% - 32px) 32px)",59 transition: { duration: 0.4, ease: [0.76, 0, 0.24, 1] },60 }61 }62 className="absolute inset-0 z-10 flex flex-col justify-center gap-2.5 bg-[#0A0A0A] px-6 text-white dark:bg-white dark:text-black"63 >64 {links.map((item) => (65 <a66 key={item.href}67 href={item.href}68 onClick={() => setOpen(false)}69 className="flex items-baseline gap-3 text-xl font-semibold tracking-tight hover:opacity-75"70 >71 <span className="font-mono text-xs opacity-50">72 {item.index}73 </span>74 <span>{item.label}</span>75 </a>76 ))}77 </motion.nav>78 )}79 </AnimatePresence>80 </div>81 );82}Usage Example
import { RadialMenu } from "@/components/ui/RadialMenu";
export default function HeaderNav() { return ( <RadialMenu links={[ { label: "Components", href: "/components", index: "01" }, { label: "Studio", href: "/studio", index: "02" }, { label: "Installation", href: "/components/installation", index: "03" }, ]} /> );}3. Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| links | RadialLink[] | required | Ordered navigation entries with numeric index markers. |