Action
Actions tell the Command Bar to perform a side effect (e.g. open a URL or copy something to the clipboard). They can be used in two places:
at the root of Command Response as
CommandResponse.actionin the Option of the List View or Masonry View as
CommandResponse.view.options[].action
export type Action =
| ActionOpenURL
| ActionPaste
| ActionCopy
| ActionShowToast
| ActionMove;
type ActionMove = ActionMoveAddParam;ActionOpenURL
Opens a given URL using the system's default handler.
type:
"open-url"url: The URL to open. You can use any valid URI schema. For example, "https://", "file://", "ssh://", "slack://" (native app). Provide a string to open a single URL or an array of strings to open multiple URLs at once.
{
"action": {
"type": "open-url",
"url": "https://slapdash.com/",
}
}{
"action": {
"type": "open-url",
"url": [
"https://google.com/",
"https://bing.com/"
]
}
}{
"view": {
"type": "list",
"options": [
{
"title": "Open Google",
"action": {
"type": "open-url",
"url": "https://www.google.com/"
}
},
{
"title": "Open Bing",
"action": {
"type": "open-url",
"url": "https://www.bing.com/"
}
}
]
}
}ActionPaste
Pastes some text to the active app.
type:
"paste"value: The string that will be pasted to the active app.
ActionCopy
Copies some text to the clipboard.
type:
"copy"value: The string that will be copied to the clipboard.
ActionShowToast
Shows a message in a toast (an ephemeral message displayed on the screen).
type:
"show-toast"message: The message that will be displayed in a toast.
ActionMoveAddParam
Allows to change the location of the Command Bar. Currently, there is only one Move Action supported – add a param. Location parameters are then passed to the Command when it's run.
Typically, the "add-param" Action is used in the moveAction property of some Option that can be triggered by pressing Tab.
type:
"add-param"name: The name of the parameter.
value: The value of the parameter.
Last updated