Playground GitHub npm

Dropdown Menu

Click-triggered action menu anchored below the trigger.

ui overlay

Preview

Installation

npx slintcn@latest add dropdown-menu

Usage

import { DropdownMenu, DropdownMenuItem } from "slintcn/components/dropdown-menu.slint";

DropdownMenu {
    items: [{ label: "Profile" }, { label: "Billing" }, { label: "Sign out" }];
    selected(i) => { /* … */ }
    Button { text: "Open menu"; }   // trigger = @children
}

Properties

items in [DropdownMenuItem]

Menu rows shown when the trigger is clicked.

content-width in length

Pixel width of the popup panel.

highlighted-index in-out int

Row highlighted by ↑/↓ inside the open popup; consumers rarely set this.

selected callback (int)

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

API

Accessibility
focusableyes
keyboardArrow keysEnter
Escapedismisses

Dependencies

theme only

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