The Reacton
pane renders Reacton components both in the notebook and in a deployed server. Reacton provides a way to write reusable components in a React-like way, to make Python-based UI's using the ipywidgets ecosystem (ipywidgets, ipyvolume, bqplot, threejs, leaflet, ipyvuetify, ...). Note that Reacton is primarily a way to write apps
In the notebook this is not necessary since Panel simply uses the regular notebook ipywidget renderer. Particularly in JupyterLab importing the ipywidgets extension in this way may interfere with the UI and render the JupyterLab UI unusable, so enable the extension with care.
Parameters:
For details on other options for customizing the component see the layout and styling how-to guides.
object
(object): The ipywidget object being displayed
Display
default_layout
(pn.layout.Panel, default=Row): Layout to wrap the plot and widgets in
The panel
function will automatically convert any ipywidgets
object into a displayable panel, while keeping all of its interactive features:
Combining Reacton and Panel components
Reacton can be used in conjunction with Panel components however we have to make two modifications:
Panel components have to be wrapped as an ipywidget using the
pn.ipywidget
wrapper (this requiresjupyter_bokeh
).The wrapped Panel component must be added to a reacton layout component.
In the example below we swap out the reacton.ipywidgets.Button
for a pn.widgets.Button
and then wrap it in pn.ipywidgets
and a reacton.ipywidgets.VBox
:
Complex examples
Even more complex applications can be built in Reacton and displayed in Panel. Here is a Calculator example from the Reacton documentation.