Primitives

Context menu

Right-click or long-press. The same items and looks as DropdownMenu; submenus, checks, a danger item.

Right-click a row (long-press on a phone).

DHA-GA 12-3456Level B · 2 h 10 m
DHA-KHA 45-1029Level B · 2 h 10 m
CTG-GA 11-8890Level B · 2 h 10 m

Import#

Everything comes from the package root. The example above uses:

your-component.tsx
import {
  ContextMenu,
  ContextMenuCheckboxItem,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuLabel,
  ContextMenuSeparator,
  ContextMenuSub,
  ContextMenuSubContent,
  ContextMenuSubTrigger,
  ContextMenuTrigger,
  toast,
} from "@waveinno/ui";

Props#

Read from the source of this version, so they match the code exactly.

<ContextMenuCheckboxItem>

src/components/ui/context-menu.tsx

Also takes ComponentPropsWithoutRef<typeof Primitive.CheckboxItem> (passed through).

<ContextMenuContent>

src/components/ui/context-menu.tsx
PropTypeDefaultDescription
variantMenuVariant"default"

Also takes ComponentPropsWithoutRef<typeof Primitive.Content>.

<ContextMenuItem>

src/components/ui/context-menu.tsx
PropTypeDefaultDescription
dangerboolean—
iconReact.ReactNode—
descriptionReact.ReactNode—
shortcutstring—

Also takes ComponentPropsWithoutRef<typeof Primitive.Item>.

<ContextMenuLabel>

src/components/ui/context-menu.tsx

Also takes ComponentPropsWithoutRef<typeof Primitive.Label> (passed through).

<ContextMenuSeparator>

src/components/ui/context-menu.tsx

Also takes ComponentPropsWithoutRef<typeof Primitive.Separator> (passed through).

<ContextMenuSubContent>

src/components/ui/context-menu.tsx

Also takes ComponentPropsWithoutRef<typeof Primitive.SubContent> (passed through).

<ContextMenuSubTrigger>

src/components/ui/context-menu.tsx

Also takes ComponentPropsWithoutRef<typeof Primitive.SubTrigger> (passed through).

Install#

If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.

$ npm install @waveinno/ui