* Components: added Menu
* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Imported from 599653f7ce
This commit is contained in:
FloVanGH 2025-08-21 07:46:30 +00:00 committed by Olivier Goffart
parent f14d04c798
commit 971bff4434
8 changed files with 199 additions and 1 deletions

View file

@ -0,0 +1,42 @@
---
<!-- Copyright © SixtyFPS GmbH <info@slint.dev> ; SPDX-License-Identifier: MIT -->
title: Menu
description: Menu API.
---
import CodeSnippetMD from '/src/components/CodeSnippetMD.astro';
import SlintProperty from '/src/components/SlintProperty.astro';
<CodeSnippetMD imagePath="/src/assets/generated/menu.png" scale="3" imageWidth="300" imageHeight="200" imageAlt="">
```slint
import { Menu } from "material.slint";
export component Example inherits Window {
width: 400px;
height: 300px;
background: transparent;
Menu {
width: 280px;
height: parent.height;
items: [
{ text: "Copy" },
{ text: "Cut" },
{ text: "Paste" },
];
}
}
```
</CodeSnippetMD>
A `Menu` display a list of choices on a temporary surface.
## Properties
### items
<SlintProperty propName="items" typeName="[struct]" structName="MenuItem">
An array of menu items, each containing an icon, a text, and a trailing text.
</SlintProperty>
## Callbacks
### item_clicked(index: int)
Invoked when a menu item is clicked