API 참조

FMenu

이 API 페이지의 본문은 현재 영어로 제공됩니다. 코드 시그니처와 식별자는 언어에 따라 바뀌지 않습니다.

This is the builder for adding a menu to Univer. You shall never construct this class by yourself. Instead, call createMenu of FUniver to create a instance.

Please notice that until the appendTo method is called, the menu item is not added to the UI.

Please note that this menu cannot have submenus. If you want to have submenus, please use FSubmenu.

createMenu() accepts order and gridLayout to position the button within its Ribbon group. See IFacadeMenuItem for the options and an example. To change an existing menu, use FUniver.updateMenuConfig().

Access

Access through:

Setup

Register @univerjs/ui or a preset that includes it. In plugin mode, import @univerjs/ui/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs/ui

FMenu.appendTo

Append the menu to any menu position on Univer UI.

TypeScript
appendTo(path: string | string[]): void

Parameters

  • path — Required. Some predefined path to append the menu. The paths can be an array, or an array joined by | separator. Since lots of submenus reuse the same name, you may need to specify their parent menus as well.

Examples

TypeScript
// This menu item will appear on every `contextMenu.others` section.univerAPI  .createMenu({    id: 'custom-menu-id-1',    title: 'Custom Menu 1',    action: () => {      console.log('Custom Menu 1 clicked')    },  })  .appendTo('contextMenu.others')// This menu item will only appear on the `contextMenu.others` section on the main area.univerAPI  .createMenu({    id: 'custom-menu-id-2',    title: 'Custom Menu 2',    action: () => {      console.log('Custom Menu 2 clicked')    },  })  .appendTo(['contextMenu.mainArea', 'contextMenu.others'])

Package: @univerjs/ui · Type definitions

Top-level menu placement identifiers for the ribbon and context menu.

TypeScript
MenuManagerPosition: typeof MenuManagerPosition

Package: @univerjs/ui · Type definitions

FMenu.RibbonPosition

Built-in ribbon tab identifiers for menu placement.

TypeScript
RibbonPosition: typeof RibbonPosition

Package: @univerjs/ui · Type definitions

FMenu.RibbonStartGroup

Built-in group identifiers for placing items on the Start ribbon tab.

TypeScript
RibbonStartGroup: typeof RibbonStartGroup

Package: @univerjs/ui · Type definitions

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.