The compacted release
There are a few interesting features in this release.
Many widgets have grown a compact reactive. If you set this to True then the widget will have a compact (borderless) style.
Reactives have a new toggle_class attribute, that toggles a TCSS classname according to the truthyness of its value. If that sounds complicated, it really isn't in practice. Let's see it in action:
class MyWidget(Widget):
compact = reactive(False, toggle_class="-textual-compact")This adds a boolean attribute to the widget. If you set compact=True then it will add the class "-textual-compact". If you set compact=False it will remove the class. Simples.
We also have breakpoint support, so you can build UIs that adjust to the dimensions of the screen. This was always possible, but it was a pattern before. Now it is a first class feature. See the breakpoints.py example.
We also have two new pseudo classes: :first-child and :last-child, which have the same meaning as browser CSS. Contributed by @sponsfreixes
There is one potential breaking change. RadioSet now has a default width of 1fr, meaning they will take up the full available space. This makes RadioSet size like other widgets. If you want the original behavior, then set the width to "auto"
[3.2.0] - 2025-05-02
Fixed
- Fixed
OptionListcausing excessive redrawing #5766 - Log messages could be written to stdout when there was no app, which could happen when using run_async or threads. Now they will be suppressed, unless the env var
TEXTUAL_DEBUGis set #5782
Added
- Added
:first-childand:last-childpseudo classes #5776 - Added
toggle_classparameter to reactives #5778 - Added
compactparameter and reactive toButton,Input,ToggleButton,RadioSet,OptionList,TextArea#5778 - Added
HORIZONTAL_BREAKPOINTSandVERTICAL_BREAKPOINTStoAppandScreen#5779
Changed
RadioSetnow has a default width of1fr#5778