MenuAnchorPosition


Class that determines the position of a menu relative to its anchor.

This allows selecting between standard positioning strategies (such as Above, Below, Start, End, Left, Right) or providing a Custom implementation for complex positioning logic.

Summary

Public companion functions

MenuAnchorPosition
Custom(xCandidates: MenuPositionScope.() -> IntList, yCandidates: MenuPositionScope.() -> IntList)

Create a custom positioning strategy by providing lambda functions for calculating candidate positions for the x and y axes.

Cmn

Public companion properties

MenuAnchorPosition

Position the menu above its anchor.

Cmn
MenuAnchorPosition

Position the menu below its anchor.

Cmn
MenuAnchorPosition

Position the menu to the end of its anchor.

Cmn
MenuAnchorPosition

Position the menu to the left of its anchor.

Cmn
MenuAnchorPosition

Position the menu to the right of its anchor.

Cmn
MenuAnchorPosition

Position the menu to the start of its anchor.

Cmn

Public companion functions

Custom

fun Custom(xCandidates: MenuPositionScope.() -> IntList, yCandidates: MenuPositionScope.() -> IntList): MenuAnchorPosition

Create a custom positioning strategy by providing lambda functions for calculating candidate positions for the x and y axes. Note that candidate positioning coordinates are calculated relative to the window bounds.

Parameters
xCandidates: MenuPositionScope.() -> IntList

Lambda that determines the list of candidate x coordinates for the menu relative to the window bounds.

yCandidates: MenuPositionScope.() -> IntList

Lambda that determines the list of candidate y coordinates for the menu relative to the window bounds.

Public companion properties

Above

val AboveMenuAnchorPosition

Position the menu above its anchor.

The menu's bottom edge is aligned with the anchor's top edge by default. If there is insufficient space, alternative positions (such as below the anchor) will be attempted.

Below

val BelowMenuAnchorPosition

Position the menu below its anchor.

The menu's top edge is aligned with the anchor's bottom edge by default. If there is insufficient space, alternative positions (such as above the anchor) will be attempted.

End

val EndMenuAnchorPosition

Position the menu to the end of its anchor.

In LTR layouts, this positions the menu on the right side of the anchor. In RTL layouts, this positions the menu on the left side of the anchor.

Left

val LeftMenuAnchorPosition

Position the menu to the left of its anchor.

This strategy positions the menu on the left side regardless of the layout direction.

Right

val RightMenuAnchorPosition

Position the menu to the right of its anchor.

This strategy positions the menu on the right side regardless of the layout direction.

Start

val StartMenuAnchorPosition

Position the menu to the start of its anchor.

In LTR layouts, this positions the menu on the left side of the anchor. In RTL layouts, this positions the menu on the right side of the anchor.