menu

fun RenderContext.menu(styling: BoxParams.() -> Unit = {}, baseClass: StyleClass = StyleClass.None, id: String? = null, prefix: String = "menu", build: MenuComponent.() -> Unit)

This component creates a menu.

A menu consists of different types of children that are aligned vertically. By default the following types can be added to the menu:

It is also possible to add any other fritz2 component via the custom context. All menu items are created directly within the MenuComponent's build context.

Example usage:

menu {
entry {
icon { add }
text("Item")
}
divider()
submenu {
text("A subsection starts here")
icon { menu }
custom {
// custom content
inputField { }
}
}
}

See also

Parameters

styling

a lambda expression for declaring the styling as fritz2's styling DSL

baseClass

optional CSS class that should be applied to the element

id

the ID of the element

prefix

the prefix for the generated CSS class resulting in the form `$prefix-$hash`

build

a lambda expression for setting up the component itself.