Skip to content

Instantly share code, notes, and snippets.

@prio
Created May 5, 2021 19:29
Show Gist options
  • Save prio/53f8a96539b6bcf85db0b0fc986801bd to your computer and use it in GitHub Desktop.
Save prio/53f8a96539b6bcf85db0b0fc986801bd to your computer and use it in GitHub Desktop.
An example of a left side panel extension for Jupyterlab.
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
ILabShell
} from '@jupyterlab/application';
import { Widget } from '@lumino/widgets';
/**
* Initialization data for the jupyterlab-sidepanel extension.
*/
const extension: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-sidepanel:plugin',
autoStart: true,
requires: [ILabShell],
activate: (app: JupyterFrontEnd, shell: ILabShell) => {
console.log('JupyterLab extension jupyterlab_apod is activated!');
// Create a blank content widget inside of a MainAreaWidget
const widget = new Widget();
widget.id = '@jupyterlab-sidepanel/example';
widget.title.iconClass = "jp-SpreadsheetIcon jp-SideBar-tabIcon";
widget.title.caption = "Side Panel";
let summary = document.createElement('p');
widget.node.appendChild(summary);
summary.innerText = "Hello, World!";
shell.add(widget, 'left');
}
};
export default extension;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment