Menu
A key that opens a menu of actions, with checkable items, groups and a submenu.
Component
Menu belongs to the Navigation group in the CyberSpec catalog. It uses @ui-sdk/react/menu.
Installation
Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/menu.json
Example
"use client"
import { BellRing, Ellipsis, MapPin, MessageSquare, PhoneCall, Share2, Trash2 } from "lucide-react"
import { Menu, type MenuEntry } from "@/components/ui/menu"
// What you can do with a contact.
const actions: MenuEntry[] = [
{ value: "call", label: "Call", icon: <PhoneCall aria-hidden />, shortcut: "mod+shift+enter" },
{ value: "message", label: "Message", icon: <MessageSquare aria-hidden />, shortcut: "mod+shift+m" },
{ value: "locate", label: "Locate", icon: <MapPin aria-hidden />, disabled: true },
{
type: "submenu",
label: "Share with",
icon: <Share2 aria-hidden />,
items: [
{ value: "share-ilya", label: "Ilya Brandt" },
{ value: "share-juno", label: "Juno Okafor" },
{ value: "share-dex", label: "Dex Marlowe" },
],
},
{ type: "separator" },
{ type: "checkbox", value: "pinned", label: "Pin to top", defaultChecked: true },
{ type: "checkbox", value: "muted", label: "Mute pings" },
{ type: "separator" },
{
type: "radio-group",
name: "trust",
label: "Trust",
defaultValue: "crew",
items: [
{ value: "crew", label: "Crew" },
{ value: "known", label: "Known" },
{ value: "burned", label: "Burned" },
],
},
{ type: "separator" },
{
value: "forget",
label: "Forget contact",
icon: <Trash2 aria-hidden />,
destructive: true,
confirm: "Removes Mara Voss and her message history from this deck",
},
]
const alerts: MenuEntry[] = [
{
type: "radio-group",
name: "alerts",
label: "Alert me",
defaultValue: "direct",
items: [
{ value: "all", label: "Every ping" },
{ value: "direct", label: "Direct only" },
{ value: "none", label: "Never" },
],
},
]
export default function MenuDemo() {
return (
<>
<Menu label="Mara Voss" items={actions} />
<Menu label="Alerts for Mara Voss" items={alerts} icon={<BellRing aria-hidden />} compact />
<Menu label="More" items={[{ value: "export", label: "Export" }]} icon={<Ellipsis aria-hidden />} compact disabled />
</>
)
}
Install this example
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/menu-demo.json