Textual - Footer (original) (raw)
Added in version 0.63.0
A simple footer widget which is docked to the bottom of its parent container. Displays available keybindings for the currently focused widget.
- Focusable
- Container
Example¶
The example below shows an app with a single keybinding that contains only a Footer
widget. Notice how the Footer
automatically displays the keybinding.
Outputfooter.py
FooterApp q Quit the app ? Show help screen del Delete the thing ▏^p palette
[](#%5F%5Fcodelineno-0-1)from textual.app import App, ComposeResult [](#%5F%5Fcodelineno-0-2)from textual.binding import Binding [](#%5F%5Fcodelineno-0-3)from textual.widgets import Footer [](#%5F%5Fcodelineno-0-4) [](#%5F%5Fcodelineno-0-5) [](#%5F%5Fcodelineno-0-6)class FooterApp(App): [](#%5F%5Fcodelineno-0-7) BINDINGS = [ [](#%5F%5Fcodelineno-0-8) Binding(key="q", action="quit", description="Quit the app"), [](#%5F%5Fcodelineno-0-9) Binding( [](#%5F%5Fcodelineno-0-10) key="question_mark", [](#%5F%5Fcodelineno-0-11) action="help", [](#%5F%5Fcodelineno-0-12) description="Show help screen", [](#%5F%5Fcodelineno-0-13) key_display="?", [](#%5F%5Fcodelineno-0-14) ), [](#%5F%5Fcodelineno-0-15) Binding(key="delete", action="delete", description="Delete the thing"), [](#%5F%5Fcodelineno-0-16) Binding(key="j", action="down", description="Scroll down", show=False), [](#%5F%5Fcodelineno-0-17) ] [](#%5F%5Fcodelineno-0-18) [](#%5F%5Fcodelineno-0-19) def compose(self) -> ComposeResult: [](#%5F%5Fcodelineno-0-20) yield Footer() [](#%5F%5Fcodelineno-0-21) [](#%5F%5Fcodelineno-0-22) [](#%5F%5Fcodelineno-0-23)if __name__ == "__main__": [](#%5F%5Fcodelineno-0-24) app = FooterApp() [](#%5F%5Fcodelineno-0-25) app.run()
Reactive Attributes¶
Name | Type | Default | Description |
---|---|---|---|
compact | bool | False | Display a more compact footer. |
show_command_palette | bool | True | Display the key to invoke the command palette (show on the right hand side of the footer). |
Messages¶
This widget posts no messages.
Bindings¶
This widget has no bindings.
Component Classes¶
This widget has no component classes.
Additional Notes¶
- You can prevent keybindings from appearing in the footer by setting the
show
argument of theBinding
toFalse
. - You can customize the text that appears for the key itself in the footer using the
key_display
argument ofBinding
.
Bases: [ScrollableContainer](../../api/containers/#textual.containers.ScrollableContainer "textual.containers.ScrollableContainer")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*children ¶ | Widget | Child widgets. | () |
name ¶ | str | None | The name of the widget. | None |
id ¶ | str | None | The ID of the widget in the DOM. | None |
classes ¶ | str | None | The CSS classes for the widget. | None |
disabled ¶ | bool | Whether the widget is disabled or not. | False |
show_command_palette ¶ | bool | Show key binding to invoke the command palette, on the right of the footer. | True |
Display in compact style.
`` show_command_palette class-attribute
instance-attribute
¶
Show the key to invoke the command palette.