Skip to main content
Version: 1.x.x

Configuring Menu Commands

quip.apps.MenuCommand

This is the interface used for configuring menu commands. A command can show up in the interface in a few places:

  • In the document, either as a button on the toolbar or as a menu option inside a toolbar item
  • On mobile devices in the mobile toolbar
  • In a context menu

id

required

string

Must be unique. Can either be an arbitrary unique string or one of quip.apps.DocumentMenuCommands.

label

optional

string

The user-facing label of this menu item.

sublabel

optional

string

A user-facing sublabel for this item. A sublabel is right-aligned and rendered in gray text.

handler

optional

Function(id: string, meta: ContextMenuMeta) => boolean

This handler will be called when this command is selected. Meta is used for sending contextual metadata when invoked via a context menu.

This should only be defined for commands that are neither defined with isHeader and contain no subCommands.

isHeader

optional

boolean=false

If this is set to true, this item is a header and is not interactive - just used for labeling sections in a menu.

subCommands

optional

string[]

Menu Commands may be nested, allowing "drill down" menu selection. If this menu item should have subCommands, this should be a set to a list of the child commands' IDs

actionId

optional

quip.apps.DocumentMenuActions

Quip provides some global actions, generally for actions that are managed by Quip and present external UI. See quip.apps.DocumentMenuActions for a list of possible values.

actionParams

optional

{[key: string]: any}

When invoking an actionId, you may need to pass parameters depending on the action you are running. This is the interface by which you can pass arguments. See quip.apps.DocumentMenuActions for more details and available parameters.

actionStarted

optional

Function(...args: any[]) => any

When invoking an actionId, it the action may need to callback when the action is started. See quip.apps.DocumentMenuActions for information on when this would be invoked.

quip.apps.DocumentMenuCommands

These constants are references to the default menus shown for the app as well as utilities like the menu separator, or built-in commands that are supported by the host.

  • MENU_MAIN: "DocumentMenu-main"

Default first toolbar button shown for the app

  • SEPARATOR: "DocumentCommand-separator"

Allows the developer to include a separator either within a submenu or to separate toolbar button groups

  • COPY_ANCHOR_LINK: "DocumentCommand-copyAnchorLink"

Default command supported by the host that will copy an anchor link to this app instance to the user's clipboard

  • DELETE_APP: "DocumentCommand-deleteApp"

Default command supported by the host that will delete this instance of the app

quip.apps.DocumentMenuActions

These constants are for special actions that can be hooked up to MenuCommands.

SHOW_FILE_PICKER: 1

Shows a file picker UI to the user.

SHOW_FILE_PICKER actionParams

mimeTypes

optional

string[]

An array of valid mime types to filter available files by.

requestedThumbnailWidths

optional

number[]

An array of thumbnail widths to generate.

SHOW_FILE_PICKER actionStarted Parameters

Function(fileList: FileList, dataTransfers: ArrayBuffer[]) => void

fileList

required

FileList

A list of selected files.

dataTransfers

required

ArrayBuffer[]

The data transfers for the selected files.