Widgets Reference

Complete list of all Textual widgets available in the builder.

Builder Schema

class genro_textual.textual_builder.TextualWidgetsMixin[source]

All Textual widget @element and @component definitions.

Defined as a mixin so that subclasses of TextualBuilder automatically inherit the full schema via MRO.

container()[source]

A generic container widget.

vertical()[source]

A container that arranges children vertically.

horizontal()[source]

A container that arranges children horizontally.

center()[source]

A container that centers its children horizontally.

middle()[source]

A container that centers its children vertically.

centermiddle()[source]

A container that centers its children both horizontally and vertically.

right()[source]

A container that aligns its children to the right.

grid()[source]

A container with grid layout.

verticalscroll()[source]

A scrollable vertical container.

horizontalscroll()[source]

A scrollable horizontal container.

scrollablecontainer()[source]

A scrollable container.

verticalgroup()[source]

A vertical group of widgets.

horizontalgroup()[source]

A horizontal group of widgets.

itemgrid(min_column_width=20)[source]

A grid container that arranges items in columns.

Parameters:

min_column_width (int)

button(content='', label=None, variant='default', tooltip=None, action=None)[source]

A simple clickable button.

Parameters:
checkbox(content='', label='', value=False, button_first=True, tooltip=None, compact=False)[source]

A check box widget that represents a boolean value.

Parameters:
collapsible(title='Toggle', collapsed=True, collapsed_symbol='▶', expanded_symbol='▼')[source]

A collapsible container.

Parameters:
  • title (str)

  • collapsed (bool)

  • collapsed_symbol (str)

  • expanded_symbol (str)

collapsibletitle(content='', label=None, collapsed_symbol=None, expanded_symbol=None, collapsed=None)[source]

Title and symbol for the Collapsible.

Parameters:
contentswitcher(initial=None)[source]

A widget for switching between different children.

Parameters:

initial (str | None)

datatable(show_header=True, show_row_labels=True, fixed_rows=0, fixed_columns=0, zebra_stripes=False, header_height=1, show_cursor=True, cursor_foreground_priority='css', cursor_background_priority='renderable', cursor_type='cell', cell_padding=1)[source]

A tabular widget that contains data.

Parameters:
  • show_header (bool)

  • show_row_labels (bool)

  • fixed_rows (int)

  • fixed_columns (int)

  • zebra_stripes (bool)

  • header_height (int)

  • show_cursor (bool)

  • cursor_foreground_priority (str)

  • cursor_background_priority (str)

  • cursor_type (str)

  • cell_padding (int)

column(label='', key=None, width=None)[source]

A column definition for DataTable.

Parameters:
row(key=None, label=None, height=1)[source]

A row for DataTable. Value can be a list of cell values.

Parameters:
digits(content='', value='')[source]

A widget to display numerical values using a 3x3 grid of unicode characters.

Parameters:
directorytree(content='', path=None)[source]

A Tree widget that presents files and directories.

Parameters:
footer(show_command_palette=True, compact=False)[source]

Textual Footer widget.

Parameters:
  • show_command_palette (bool)

  • compact (bool)

header(content='', show_clock=False, icon=None, time_format=None)[source]

A header widget with icon and clock.

Parameters:
helppanel(markup=True)[source]

Textual HelpPanel widget.

Parameters:

markup (bool)

input(content='', value=None, placeholder='', password=False, restrict=None, type='text', max_length=0, valid_empty=False, select_on_focus=True, tooltip=None, compact=False)[source]

A text input widget.

Parameters:
keypanel(can_focus=None, can_focus_children=None, can_maximize=None)[source]

Textual KeyPanel widget.

Parameters:
label(content='', variant=None, expand=False, shrink=False, markup=True)[source]

A simple label widget for displaying text-oriented renderables.

Parameters:

A simple, clickable link that opens a URL.

Parameters:
listitem(markup=True)[source]

A widget that is an item within a ListView.

Parameters:

markup (bool)

listview(initial_index=0)[source]

A vertical list view widget.

Parameters:

initial_index (int)

loadingindicator(content='')[source]

Display an animated loading indicator.

Parameters:

content (str)

log(content='', highlight=False, max_lines=None, auto_scroll=True)[source]

A widget to log text.

Parameters:
markdown(content='', markdown=None, parser_factory=None, open_links=True)[source]

Textual Markdown widget.

Parameters:
markdownviewer(content='', markdown=None, show_table_of_contents=True, parser_factory=None, open_links=True)[source]

A Markdown viewer widget.

Parameters:
maskedinput(content='', template=None, value=None, placeholder='', valid_empty=False, select_on_focus=True, tooltip=None, compact=False)[source]

A masked text input widget.

Parameters:
optionlist(markup=True, compact=False)[source]

A navigable list of options.

Parameters:
placeholder(content='', label=None, variant='default')[source]

A simple placeholder widget to use before you build your custom widgets.

Parameters:
pretty(content='', object=None)[source]

A pretty-printing widget.

Parameters:
progressbar(content='', total=None, show_bar=True, show_percentage=True, show_eta=True)[source]

A progress bar widget.

Parameters:
radiobutton(content='', label='', value=False, button_first=True, tooltip=None, compact=False)[source]

A radio button widget that represents a boolean value.

Parameters:
radioset(tooltip=None, compact=False)[source]

Widget for grouping a collection of radio buttons into a set.

Parameters:
richlog(content='', max_lines=None, min_width=78, wrap=False, highlight=False, markup=False, auto_scroll=True)[source]

A widget for logging Rich renderables and text.

Parameters:
rule(content='', orientation='horizontal', line_style='solid')[source]

A rule widget to separate content, similar to a <hr> HTML tag.

Parameters:
  • content (str)

  • orientation (str)

  • line_style (str)

select(content='', options=None, prompt='Select', allow_blank=True, value=None, type_to_search=True, tooltip=None, compact=False)[source]

Widget to select from a list of possible options.

Parameters:
selectionlist(compact=False)[source]

A vertical selection list that allows making multiple selections.

Parameters:

compact (bool)

sparkline(content='', data=None, min_color=None, max_color=None, summary_function=None)[source]

A sparkline widget to display numerical data.

Parameters:
static(content='', expand=False, shrink=False, markup=True)[source]

A widget to display simple static content.

Parameters:
switch(content='', value=False, animate=True, tooltip=None)[source]

A switch widget that represents a boolean value.

Parameters:
tab(content='', label=None)[source]

A Widget to manage a single tab within a Tabs widget.

Parameters:
tabpane(title=None)[source]

A container for switchable content, with additional title.

Parameters:

title (str | None)

tabbedcontent(initial='')[source]

A container with associated tabs to toggle content visibility.

Parameters:

initial (str)

tabs(active=None)[source]

A row of tabs.

Parameters:

active (str | None)

textarea(content='', text='', language=None, theme='css', soft_wrap=True, tab_behavior='focus', read_only=False, show_cursor=True, show_line_numbers=False, line_number_start=1, max_checkpoints=50, tooltip=None, compact=False, highlight_cursor_line=True, placeholder='')[source]

Textual TextArea widget.

Parameters:
tooltip(content='', expand=False, shrink=False, markup=True)[source]

Textual Tooltip widget.

Parameters:
tree(content='', label=None, data=None, store=None)[source]

A widget for displaying and navigating data in a tree.

Parameters:
  • store (object | None) – A Bag object. The tree is populated recursively from its structure.

  • content (str)

  • label (str | None)

  • data (str | None)

welcome(content='', expand=False, shrink=False, markup=True)[source]

A Textual welcome widget.

Parameters:
css(content='')[source]

CSS stylesheet applied to the live app.

Parameters:

content (str)

binding(key='', action='', description='')[source]

Key binding: maps a key press to an action method.

Parameters:
fieldset(comp, title='', **kwargs)[source]

A group of input fields with a title. Closed: returns parent for chaining.

form(comp, title='', **kwargs)[source]

A form container. Open: returns internal bag for adding fields.