New features and improvements
- New dependency management to reduce payload, improve load times and support ESM (#658 by @dclause, @falkoschindler)
- Simplify API for registering custom Vue components and JavaScript dependencies (#1134 by @rodja, @falkoschindler)
- Improve generic event registration to provide access to sender and additional event arguments (#583, #664, #672, #1095 by @michelemoretti, @bobanovo, @falkoschindler)
- Provide source maps for minified dependencies (#753 by @aaad, @falkoschindler)
- Tech-preview for NiceGUI On Air: use
ui.run(on_air=True)
to get a temporary public URL through which your local app is accessible via the internet (@falkoschindler, @rodja) - Reduce size of PyPI package by making pywebview, plotly and matplotlib optional (#1010, #1143 by @firai, @rodja)
- Use snake_case style arguments for
ui.notify()
(#930 by @CatamountJack) - Allow using
ui.menu
for custom context menus (#747 by @falkoschindler) - Remove
no-parent-event
prop forui.menu
(#713 by @falkoschindler) - Add
on_change
parameter forui.knob
(#1119 by @rodja) - Add
ui.scroll_area
element (#1072 by @eli-kha, @falkoschindler)
Bugfixes
- Fix memory leak on client when removing elements (#1089 by @Kamil-Och, @CrystalWindSnake, @falkoschindler)
- Fix
on_shutdown
callback not being called on Windows 10 (#1050 by @chhinze, @firai) - Fix
ui.footer(fixed=False)
(#1136 by @falkoschindler) - Find IP addresses more robustly using netifaces (#1137 by @falkoschindler)
- Fix two favicon issues (#1139 by @falkoschindler)
- Fix table selection not going away after removing selection (#1115, #1122 by @struffel, @Trickshotblaster, @falkoschindler)
Documentation
Breaking changes and migration guide
Generic event registration with .on()
The argument passed to the event handler is now of type GenericEventArguments
. So instead of
grid.on('cellClicked', lambda msg: ui.label(f'{msg["args"]["data"]["name"]} has been clicked!'))
we access the event arguments like this:
grid.on('cellClicked', lambda e: ui.label(f'{e.args["data"]["name"]} has been clicked!'))
See https://nicegui.io/documentation/generic_events for more information.
Custom Vue components and JavaScript libraries
We radically simplified the API to register custom components and external libraries.
Now you can pass the location of the component and additional libraries as parameter to the derived class:
class CustomElement(ui.element, component='custom_element.js', libraries=['lib/some-library.min.js']):
super().__init__()
...
Note that you don't have to pass a tag
to the base initializer. It will be set automatically.
Besides libraries
you can specify exposed_libraries
(will be added to importmaps
) and extra_libraries
(will be registered but not automatically requested by that element).
All library parameters support absolute and relative paths (relative to the Python file), either as str
or as Path
, and support globbing.
Exclude parameter
The exclude
parameter of ui.run
is gone.
Due to NiceGUI's new dynamic dependency management there is no need to explicitly exclude individual elements.
Python 3.7
With NiceGUI 1.3 we drop support for Python 3.7, which had its end of life on June 27, 2023.