Marking Menu
A radial menu you hold to open or flick to pick blind, built with React and Motion.
Installation
npx shadcn@latest add @kokonutui/marking-menu
Props
| Prop |
Type |
Default |
Description |
items? |
MarkingMenuItem[] |
built-in |
Up to eight destinations, laid out clockwise from the top. |
onSelect? |
(item: MarkingMenuItem) => void |
|
Called with the item picked, by menu, flick or keyboard. |
children? |
ReactNode |
|
The surface the menu opens over. Defaults to a small demo page. |
className? |
string |
|
Extra classes for the root element. |
MarkingMenuItem
| Field |
Type |
Description |
id |
string |
|
label |
string |
|
icon |
LucideIcon |
|
Source
"use client";
export interface MarkingMenuItem {
id: string;
label: string;
icon: LucideIcon;
}
export interface MarkingMenuProps {
items?: MarkingMenuItem[];
onSelect?: (item: MarkingMenuItem) => void;
children?: ReactNode;
className?: string;
}
const DEFAULT_ITEMS: MarkingMenuItem[] = [
{ id: "home", label: "Home", icon: House },
{ id: "inbox", label: "Inbox", icon: Inbox },
{ id: "calendar", label: "Calendar", icon: CalendarDays },
{ id: "files", label: "Files", icon: Folder },
{ id: "search", label: "Search", icon: Search },
{ id: "compose", label: "Compose", icon: PenLine },
{ id: "profile", label: "Profile", icon: User },
{ id: "settings", label: "Settings", icon: Settings },
];
// Additional reactive functions and constants defined here...
export default function MarkingMenu({
items = DEFAULT_ITEMS,
onSelect,
children,
className,
}: MarkingMenuProps) {
// Component implementation, including references and state management.
}