-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Rule widget #2982
Description
This issue concerns itself with adding a new widget to Textual.
The rule widget should be similar to HTML rules.
The key difference is that HTML only has a horizontal rule and Rule's orientation can be customised ("horizontal" or "vertical").
You will want to implement a method render that is responsible for returning the characters that make up the rule itself.
You may also look at _progress_bar.py::Bar.render and _progress_bar.py::Bar.render_indeterminate for some inspiration on how to implement “a line” that you can render.
I suggest you start by implementing a horizontal rule.
After it works well, think about creating a vertical rule as well and make it customisable via a parameter, e.g., Rule(orientation="horizontal") and Rule(orientation="vertical").
Take a look at #2333 to see what files need to be changed when you implement a new widget.
Then, don't be like me and also do the final step shown in #2399 to add your new widget to the widget gallery.
Good luck and have fun!