Skip to main content

addCallback(callbackKey, callbackFn)

Adds a callback function to CommandBar. The callback function provided is mapped to callbackKey, and can be attached to actions by referencing callbackKey in a command config.

See this doc that talks about how callback actions work.


// Assumes an argument called "name"
(args, context) => alert(`Hi there, ${}!`)

Method parameters

callbackKey Required


Key to reference the provided function

callbackFn Required


Callback function, with the following signature:

argsobjectA dictionary of argument keys and the values entered by the user
contextobjectA dictionary reflecting the state of context when the callback was triggered by a command execution