Skip to main content

setRelaunchData

Sets state on the node to show a button and description when the node is selected. Clears the button and description when relaunchData is {}.

info

In Figma and Dev Mode, this shows up in the properties panel. In FigJam, this shows up in the property menu. See here for examples.

Signature

setRelaunchData(data: { [command: string]: string }): void

Parameters

data

{
[command: string]: string // description
}

e.g. data = { myCommand: 'Short description' }

command

The string that will be passed as figma.command when the plugin is run after the button is clicked. This command must be present in the manifest under one of the relaunchButtons, which is used to look up the name to display for the button.

description

Up to three lines of text that will be displayed under the button to provide plugin specific information about the node or any clarification about the action the button will perform. This method will throw if description exceeds 1000 characters, but the UI will display even less (only 3 lines).

Remarks

Each call to this method sets entirely new relaunch data, removing any relaunch data and associated buttons/descriptions from before. To maintain buttons from a previous call one can store the button information using setPluginData and later fetch it with getPluginData before passing it on to setRelaunchData.

To use this API, the plugin manifest must include a relaunchButtons section: see the manifest guide for more information.

info

Note that if the command passed to this method does not match a command in the manifest, nothing will be displayed. Similarly if the name of a command in the manifest changes or is removed, then all buttons with that command will disappear. This behavior can be used to remove buttons when a particular action is no longer supported by the plugin.

In Figma design, the relaunch data can also be placed on the PageNode or DocumentNode, to show a button and description when nothing is selected. Relaunch buttons added to the PageNode will be displayed on that page, combined with buttons from the DocumentNode that show on every page. This is not supported in FigJam.

Examples

manifest.json
// With the following in the manifest:
"relaunchButtons": [
{"command": "edit", "name": "Edit shape"},
{"command": "open", "name": "Open Shaper", "multipleSelection": true}
]
code.ts
// Add two buttons (ordered by the above array from the manifest):
// * an "Edit shape" button with a description of "Edit this trapezoid
// with Shaper" that runs the plugin with `figma.command === 'edit'`.
// * an "Open Shaper" button with no description that runs the plugin with
// `figma.command === 'open'`.
node.setRelaunchData({ edit: 'Edit this trapezoid with Shaper', open: '' })

// With the following in the manifest:
"relaunchButtons": [
{"command": "relaunch", "name": "Run again", "multipleSelection": true}
]

// Pass an empty description to show only a button
node.setRelaunchData({ relaunch: '' })

// Remove the button and description
node.setRelaunchData({})

Example Figma Design UI

Relaunch UI in Figma Design

Example FigJam UI

Relaunch UI in FigJam