Skip to content

Context menu

Secondary actions kept close to the selected object.

MenuAction
npx shadcn@latest add @silicon-ui/context-menu

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/context-menu

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/context-menu/context-menu.tsx
    • components/silicon-ui/context-menu/context-menu.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/fluid-hover.tsx
    • components/silicon-ui/lib/menu-highlight.tsx
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { ContextMenu } from "@/components/silicon-ui/context-menu/context-menu";

API reference

PropTypeDefault
children*ReactNode—
items*ContextMenuItem[]—
labelstring"Context menu"

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens