Skip to content

Commit 0522d5d

Browse files
committed
Jupyter Widgets
1 parent 4cca90b commit 0522d5d

10 files changed

Lines changed: 1967 additions & 17 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,41 @@ Limits of automatic cleanup:
105105
- It will not automatically remove all event listeners or timers.
106106
- It cannot safely revert all stateful third-party module internals.
107107

108+
## Jupyter Widgets
109+
110+
The kernel provides built-in support for [Jupyter Widgets](https://ipywidgets.readthedocs.io/) (`ipywidgets`-compatible). Widget classes are available as globals in the kernel runtime — just instantiate and call `.display()`:
111+
112+
```javascript
113+
const slider = new IntSlider({
114+
value: 50,
115+
min: 0,
116+
max: 100,
117+
description: 'My Slider'
118+
});
119+
display(slider);
120+
121+
slider.on('change:value', (newVal) => {
122+
console.log('Slider value:', newVal);
123+
});
124+
```
125+
126+
Widgets auto-display when they are the last expression in a cell. Use the global `display()` function to display a widget explicitly, for example when assigning to a variable.
127+
128+
### Available widgets
129+
130+
- **Numeric**: `IntSlider`, `FloatSlider`, `IntProgress`, `FloatProgress`, `IntText`, `FloatText`, `BoundedIntText`, `BoundedFloatText`
131+
- **Boolean**: `Checkbox`, `ToggleButton`, `Valid`
132+
- **Selection**: `Dropdown`, `RadioButtons`, `Select`, `ToggleButtons`, `SelectionSlider`
133+
- **String**: `Text`, `Textarea`, `Password`, `Combobox`
134+
- **Display**: `Label`, `HTML`, `HTMLMath`
135+
- **Button**: `Button` (with `.onClick()` handler)
136+
- **Color**: `ColorPicker`
137+
- **Containers**: `Box`, `HBox`, `VBox`, `GridBox`, `Accordion`, `Tab`, `Stack`
138+
139+
> **Note:** `jupyterlab-widgets` and `@jupyter-widgets/controls` must be available in the JupyterLite deployment for widgets to render.
140+
141+
See the [example notebook](examples/widgets.ipynb) for more usage examples.
142+
108143
### Enable or disable specific modes
109144

110145
The two runtime modes are registered by separate plugins:

0 commit comments

Comments
 (0)