Skip to content

What libraries does Reacton support

Reacton can work with any ipywidget library, such as ipyleaflet, ipydatagrid or bqplot.

When Reacton is imported, we add the .element(...) method to the base ipywidget.Widget base class. This allows us to create a Reacton element for all existing widgets. For example:

import ipywidgets
button_element = ipywidgets.Button.element(description="Click me")

However, because we care about type safety, we generate wrapper components for some libraries. This enables type completion in VSCode, type checks with VSCode, and mypy.

The following libraries are fully wrapped:

  • ipywidgets wrapper: reacton.ipywidgets
  • ipyvuetify wrapper: reacton.ipyvuetify
  • bqplot wrapper: reacton.bqplot
  • ipycanvas wrapper: reacton.ipycanvas

This allows us to do instead:

import reacton.ipywidgets as w
button_element = w.Button(description="Click me")

And enjoy auto complete and type checking.

Create your own wrapper

The best example would be to take a look at the source code for now:

The code is generated by executing:

$ python -m reacton.ipywidgets


Reacton assumes the widget constructor arguments match the traits. If this is not the case, this may result in runtime errors. If this leads to issues, please open an Issue to discuss this.