Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.2 KB

README.md

File metadata and controls

38 lines (27 loc) · 1.2 KB

Toolbar Item

This example shows how to add a button to the notebook toolbar.

Toolbar button

In this particular example, the button will clear all cell outputs.

If the wanted action is already defined as a command like in this case, you will not need to add any code. Otherwise you will need to add a new command.

Actually you can do this by updating your user settings.

To add a button triggering a command to the notebook toolbar, you must specified the following settings:

// schema/plugin.json#L2-L9

"jupyter.lab.toolbars": {
  "Notebook": [
    {
      "name": "clear-all-outputs",
      "command": "notebook:clear-all-cell-outputs"
    }
  ]
},

The key Notebook inform JupyterLab about which widget toolbar should be extended. The name should be an unique identifier for the widget toolbar items. The command is the unique command identifier. For JupyterLab core commands, you can look at that list to find it.

Where to Go Next

This example uses a command to display the widget. Have a look a the commands example for more information about it.