Skip to content

Textual adds Sparklines, Selection list, Input validation, and tool tips

It's been 12 days since the last Textual release, which is longer than our usual release cycle of a week.

We've been a little distracted with our "dogfood" projects: Frogmouth and Trogon. Both of which hit 1000 Github stars in 24 hours. We will be maintaining / updating those, but it is business as usual for this Textual release (and it's a big one). We have such sights to show you.

Sparkline widget

A Sparkline is essentially a mini-plot. Just detailed enough to keep an eye on time-series data.

SparklineColorsApp

Colors are configurable, and all it takes is a call to set_interval to make it animate.

Selection list

Next up is the SelectionList widget. Essentially a scrolling list of checkboxes. Lots of use cases for this one.

SelectionListApp SelectionListApp  Shall we play some games? ────────────────────────────────── XFalken's Maze XBlack Jack XGin Rummy XHearts XBridge XCheckers XChess XPoker XFighter Combat ──────────────────────────────────────────────────────────────

Tooltips

We've added tooltips to Textual widgets.

The API couldn't be simpler: simply assign a string to the tooltip property on any widget. This string will be displayed after 300ms when you hover over the widget.

TooltipApp ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Click me ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear.

As always, you can configure how the tooltips will be displayed with CSS.

Input updates

We have some quality of life improvements for the Input widget.

You can now use a simple declarative API to validating input.

InputApp Enter an even number between 1 and 100 that is also a palindrome. ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ foo ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ['Must be a valid number.''Value is not even.'"That's not a palindrome :/"]

Also in this release is a suggestion API, which will suggest auto completions as you type. Hit right to accept the suggestion.

Here's a screenshot:

FruitsApp ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ strawberry ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

You could use this API to offer suggestions from a fixed list, or even pull the data from a network request.

Join us

Development on Textual is fast. We're very responsive to issues and feature requests.

If you have any suggestions, jump on our Discord server and you may see your feature in the next release!