Custom Toolbar Button

I’m trying to update the toolbar button code from its current form:

To the newer method which seems to be described in extension-examples/toolbar-button at main · jupyterlab/extension-examples · GitHub involving a plugin.json file that wasn’t there before.

Though when I try to test from the example I’m not getting any button. JL 4: Toolbar Button with icon and text has some suggestions, though I’m not getting any button when testing with that either.

Is there a porting document for how to move from the older to newer extension layout? Or any hints on how I can get a toolbar button working as an extension?

I don’t know if this helps but I had to do the same thing – port an old toolbar button to the JH 4/NB 7 extension format.

Here is the repo for the updated toolbar button:

I did not really “port it”. I made a new repo, set it up correctly for a toolbar button, and then grabbed relevant business logic to render it correctly from the old repo.

Hope that helps

1 Like

This was helpful. Got me on the right path for installing the example.
pip install -e "git+https://github.com/jupyterlab/extension-examples.git#egg=jupyterlab-examples-toolbar-button&subdirectory=toolbar-button"

Being the thing that I needed. Now to see if I can get the code updated :slight_smile:

Thanks!

@Sean_Morris from your code I can see that you’ve figured out something that I’m struggling with.

If I start with the instructions from Extension Tutorial — JupyterLab 4.1.2 documentation I can get an installed extension. If I then copy in the src/index.ts and schema/plugin.json from: extension-examples/toolbar-button at main · jupyterlab/extension-examples · GitHub
My extension still installs, but I do not see the toolbar button. Meanwhile if I run a pip install -ve . from the toolbar button example directory directly it installs the toolbar button example. The only difference that I found of note was in package.json there is a reference to “schemaDir” which wasn’t created from the tutorial. Though duplicating it does not seem to assist.

Any idea where I’m going wrong?

Thank you!