Skip to content

Commit bf7ed56

Browse files
feat(ui5-menu): add placement api (#12554)
With this PR we introduce a new placement property to the ui5-menu. This property allows developers to specify the menu's position relative to its trigger element, providing more control over the menu's placement in the UI. The possible values for this property are Start, End, Top and Bottom, where Bottom is the default. Example To make the ui5-menu to open from the top add the following: <ui5-menu placement="Top"> .... </ui5-menu> image
1 parent cd5e11a commit bf7ed56

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/main/src/Menu.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { isInstanceOfMenuItem } from "./MenuItem.js";
2929
import { isInstanceOfMenuItemGroup } from "./MenuItemGroup.js";
3030
import { isInstanceOfMenuSeparator } from "./MenuSeparator.js";
3131
import type PopoverHorizontalAlign from "./types/PopoverHorizontalAlign.js";
32+
import type PopoverPlacement from "./types/PopoverPlacement.js";
3233
import type {
3334
ListItemClickEventDetail,
3435
} from "./List.js";
@@ -200,6 +201,15 @@ class Menu extends UI5Element {
200201
@property({ type: Boolean })
201202
open = false;
202203

204+
/**
205+
* Determines on which side the component is placed at.
206+
* @default "Bottom"
207+
* @public
208+
* @since 2.16.0
209+
*/
210+
@property()
211+
placement: `${PopoverPlacement}` = "Bottom";
212+
203213
/**
204214
* Determines the horizontal alignment of the menu relative to its opener control.
205215
* @default "Start"

packages/main/src/MenuTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function MenuTemplate(this: Menu) {
1010
<ResponsivePopover
1111
id={`${this._id}-menu-rp`}
1212
class="ui5-menu-rp"
13-
placement="Bottom"
13+
placement={this.placement}
1414
verticalAlign="Bottom"
1515
horizontalAlign={this.horizontalAlign}
1616
opener={this.opener}

0 commit comments

Comments
 (0)