Widgets
Genro Textual wraps 60+ Textual widgets as builder elements. All are available as methods on the page/container.
Containers
Method |
Widget |
Description |
|---|---|---|
|
Vertical |
Arrange children vertically |
|
Horizontal |
Arrange children horizontally |
|
Grid |
Grid layout |
|
Center |
Center children horizontally |
|
Middle |
Center children vertically |
|
VerticalScroll |
Scrollable vertical |
|
HorizontalScroll |
Scrollable horizontal |
|
Container |
Generic container |
Input Widgets
Method |
Widget |
Binding |
|---|---|---|
|
Input |
Writes on blur |
|
Checkbox |
Writes on change |
|
Switch |
Writes on change |
|
RadioButton |
Toggle |
|
RadioSet |
Group of radio buttons |
|
Select |
Dropdown |
|
TextArea |
Multi-line input |
|
Button |
Click handler |
Display Widgets
Method |
Widget |
Description |
|---|---|---|
|
Static |
Display text (bindable) |
|
Label |
Simple label |
|
Markdown |
Render markdown |
|
Rule |
Horizontal/vertical rule |
|
ProgressBar |
Progress indicator |
|
Sparkline |
Data visualization |
|
Digits |
Large digit display |
|
Log |
Append-only text |
|
RichLog |
Rich-formatted log |
Complex Widgets
Method |
Widget |
Description |
|---|---|---|
|
TabbedContent |
Tab container |
|
TabPane |
Tab content |
|
DataTable |
Table with columns/rows |
|
Tree |
Hierarchical tree |
|
Collapsible |
Expandable section |
|
DirectoryTree |
File browser |
App Widgets
Method |
Widget |
Description |
|---|---|---|
|
Header |
App header bar |
|
Footer |
Footer with bindings |
Components
Components are reusable composite elements defined with @component in mixin classes. They live in genro_textual.components.
Method |
Mixin |
Slots |
Description |
|---|---|---|---|
|
FoundationMixin |
|
Full app layout with inspector drawer |
|
TextualWidgetsMixin |
— |
Group of fields with title |
|
TextualWidgetsMixin |
— |
Form container |
Components can declare named slots — insertion points where the caller adds content:
shell = page.app_shell(title="My App", data_store=self.data)
shell.content.static("Hello!") # adds to the 'content' slot
shell.content.input(value="^name") # also in the 'content' slot
Config (Non-Widget)
Method |
Description |
|---|---|
|
Inline CSS stylesheet |
|
Key binding |
Tree with Store
The Tree widget can display a Bag structure:
page.tree(label="data", store=self.data)
The tree populates recursively. When the Bag changes, the tree updates preserving expanded state.