A draggable compass dial that doubles as a nav menu — scroll rotates it with physical lag, and links entering the active zone scale up and light with the accent.
Dependencies
Interaction Type
Drag the dial to spin it with momentum, or scroll the page to rotate it. Links passing through the active zone scale up and highlight.
Props
Options you can pass to customize this component.
links*Nav entries placed around the dial. Each has an `angle` (0 = top, clockwise), a `label`, and an `href`.
activeZoneAngle*Angle in degrees (0 = top, clockwise) of the active-zone pointer. Links near it get the highlight treatment.
activeZoneThresholdHalf-width of the active-zone cone in degrees. Defaults to 15.
roseRotationExtra rotation of the compass rose in degrees. The artwork's spikes already sit on the diagonals, so the default of 0 keeps them aligned to the 45/135/225/315 marks.
tickCountNumber of tick marks around the dial. Defaults to 180.
sizeSVG viewBox size in px (square); all radii scale from it. The rendered element stays fluid. Defaults to 756.
showDetailsRenders the active-zone cone plus a live rotation and active-link readout. Defaults to false.
labelAccessible name for the navigation landmark. Defaults to "Navigation compass".
classNameExtra classes merged onto the root element.
Installation
How to use
import { NavigationCompass } from "@/components/illustration/navigation-compass"
const links = [
{ angle: 0, label: "Home", href: "/" },
{ angle: 90, label: "Studio", href: "/studio" },
{ angle: 180, label: "About", href: "/about" },
{ angle: 270, label: "Contact", href: "/contact" },
]
export function Example() {
return <NavigationCompass links={links} activeZoneAngle={0} />
}Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.