textual.containers
Container widgets for quick styling.
With the exception of Center
and Middle
containers will fill all of the space in the parent widget.
Center
¶
Bases: Widget
A container which aligns children on the X axis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
Container
¶
Bases: Widget
Simple container widget, with vertical layout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
Grid
¶
Bases: Widget
A container with grid layout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
Horizontal
¶
Bases: Widget
An expanding container with horizontal layout and no scrollbars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
HorizontalGroup
¶
Bases: Widget
A non-expanding container with horizontal layout and no scrollbars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
HorizontalScroll
¶
HorizontalScroll(
*children,
name=None,
id=None,
classes=None,
disabled=False,
can_focus=None,
can_focus_children=None,
can_maximize=None,
)
Bases: ScrollableContainer
A container with horizontal layout and an automatic scrollbar on the X axis.
name: The name of the widget.
id: The ID of the widget in the DOM.
classes: The CSS classes for the widget.
disabled: Whether the widget is disabled or not.
can_focus: Can this container be focused?
can_focus_children: Can this container's children be focused?
can_maximized: Allow this container to maximize? `None` to use default logic.,
ItemGrid
¶
ItemGrid(
*children,
name=None,
id=None,
classes=None,
disabled=False,
min_column_width=None,
stretch_height=True,
regular=False,
)
Bases: Widget
A container with grid layout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
|
bool
|
Expand the height of widgets to the row height. |
True
|
|
int | None
|
The smallest permitted column width. |
None
|
|
bool
|
All rows should have the same number of items. |
False
|
Middle
¶
Bases: Widget
A container which aligns children on the Y axis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
Right
¶
Bases: Widget
A container which aligns children on the X axis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
ScrollableContainer
¶
ScrollableContainer(
*children,
name=None,
id=None,
classes=None,
disabled=False,
can_focus=None,
can_focus_children=None,
can_maximize=None,
)
Bases: Widget
A scrollable container with vertical layout, and auto scrollbars on both axis.
name: The name of the widget.
id: The ID of the widget in the DOM.
classes: The CSS classes for the widget.
disabled: Whether the widget is disabled or not.
can_focus: Can this container be focused?
can_focus_children: Can this container's children be focused?
can_maximized: Allow this container to maximize? `None` to use default logic.,
BINDINGS
class-attribute
¶
BINDINGS = [
Binding("up", "scroll_up", "Scroll Up", show=False),
Binding(
"down", "scroll_down", "Scroll Down", show=False
),
Binding("left", "scroll_left", "Scroll Up", show=False),
Binding(
"right", "scroll_right", "Scroll Right", show=False
),
Binding(
"home", "scroll_home", "Scroll Home", show=False
),
Binding("end", "scroll_end", "Scroll End", show=False),
Binding("pageup", "page_up", "Page Up", show=False),
Binding(
"pagedown", "page_down", "Page Down", show=False
),
Binding(
"ctrl+pageup", "page_left", "Page Left", show=False
),
Binding(
"ctrl+pagedown",
"page_right",
"Page Right",
show=False,
),
]
Keyboard bindings for scrollable containers.
Key(s) | Description |
---|---|
up | Scroll up, if vertical scrolling is available. |
down | Scroll down, if vertical scrolling is available. |
left | Scroll left, if horizontal scrolling is available. |
right | Scroll right, if horizontal scrolling is available. |
home | Scroll to the home position, if scrolling is available. |
end | Scroll to the end position, if scrolling is available. |
pageup | Scroll up one page, if vertical scrolling is available. |
pagedown | Scroll down one page, if vertical scrolling is available. |
ctrl+pageup | Scroll left one page, if horizontal scrolling is available. |
ctrl+pagedown | Scroll right one page, if horizontal scrolling is available. |
Vertical
¶
Bases: Widget
An expanding container with vertical layout and no scrollbars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
VerticalGroup
¶
Bases: Widget
A non-expanding container with vertical layout and no scrollbars.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Widget
|
Child widgets. |
()
|
|
str | None
|
The name of the widget. |
None
|
|
str | None
|
The ID of the widget in the DOM. |
None
|
|
str | None
|
The CSS classes for the widget. |
None
|
|
bool
|
Whether the widget is disabled or not. |
False
|
VerticalScroll
¶
VerticalScroll(
*children,
name=None,
id=None,
classes=None,
disabled=False,
can_focus=None,
can_focus_children=None,
can_maximize=None,
)
Bases: ScrollableContainer
A container with vertical layout and an automatic scrollbar on the Y axis.
name: The name of the widget.
id: The ID of the widget in the DOM.
classes: The CSS classes for the widget.
disabled: Whether the widget is disabled or not.
can_focus: Can this container be focused?
can_focus_children: Can this container's children be focused?
can_maximized: Allow this container to maximize? `None` to use default logic.,