Playground GitHub npm

Context Menu

Right-click menu over an area; opens at the cursor.

ui overlay

Preview

Installation

npx slintcn@latest add context-menu

Usage

import { ContextMenu, ContextMenuItemData } from "slintcn/components/context-menu.slint";

ContextMenu {
    items: [{ label: "Cut" }, { label: "Copy" }, { label: "Paste" }];
    selected(i) => { /* … */ }
    // right-clickable area = @children
}

Properties

items in [ContextMenuItemData]

Menu rows shown on right-click.

selected callback (int)

Fired with the chosen row's index; the menu auto-closes.

menu-x in-out length

Internal — where the menu opens horizontally (set on right-click).

menu-y in-out length

Internal — where the menu opens vertically (set on right-click).

API

Accessibility
focusableyes
keyboardEscape
Escapedismisses

Dependencies

theme only

Installed automatically as transitive dependencies of slintcn add context-menu.