Menu

fun TileSchemaBuilderScope.Menu(id: String = randomId(), style: StyleSchemaBuilderScope.() -> Unit = {}, visibility: TileSchema.Visibility = visible(), searchableTerms: List<String>? = null, expanded: Boolean = false, items: MenuItemSchemaBuilderScope.() -> Unit, events: EventSchemaBuilderScope.() -> Unit = {}, tiles: TileSchemaBuilderScope.() -> Unit)

Renders an anchor — tiles, laid out with Box semantics and carrying style and visibility — with a Material 3 dropdown menu attached to it. The menu lists one entry per item declared via items (built with addMenuItem), each showing its label plus an optional leading/trailing icon. The menu uses the large theme shape, respects the system bars and is capped at 400dp tall (scrolling beyond that). expanded drives the menu; dismissing it (tapping outside or pressing back) flips expanded locally on the client, with no server round trip needed. Opening and closing from the server side is done with a ToggleMenu event pointing at this tile's id — typically wired to the anchor's click to open, and to an item's click chain to close after acting on the selection. style and visibility apply to the anchor only — the dropdown itself is positioned by Material and unaffected by them. Dispatches onMenuItemClick(itemId) when an item is tapped, so events can be wired per item.

Parameters

id

Unique identifier of the tile. Defaults to a random id.

style

Layout/appearance modifiers applied to the anchor (size, padding, background, etc).

visibility

Whether the anchor is shown, hidden but occupies space, or removed from layout. Defaults to visible.

searchableTerms

Terms used by an ancestor's search/filter to decide whether this tile matches. Defaults to none.

expanded

Whether the dropdown menu starts open. Defaults to false.

items

Menu entries, declared with addMenuItem.

events

Events owned by this tile, wired to its triggers (e.g. onMenuItemClick).

tiles

Child tiles forming the clickable anchor the menu is attached to.