Skip to content

ClassicFooter

Deprecated widget

This is an older version of the Textual Footer, and will be replaced with Footer in Textual v1.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 ClassicFooter widget. Notice how the ClassicFooter automatically displays the keybinding.

FooterApp  q  Quit the app  ?  Show help screen  delete  Delete the thing 

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import ClassicFooter


class FooterApp(App):
    BINDINGS = [
        Binding(key="q", action="quit", description="Quit the app"),
        Binding(
            key="question_mark",
            action="help",
            description="Show help screen",
            key_display="?",
        ),
        Binding(key="delete", action="delete", description="Delete the thing"),
        Binding(key="j", action="down", description="Scroll down", show=False),
    ]

    def compose(self) -> ComposeResult:
        yield ClassicFooter()


if __name__ == "__main__":
    app = FooterApp()
    app.run()

Reactive Attributes

Name Type Default Description
highlight_key str None Stores the currently highlighted key. This is typically the key the cursor is hovered over in the footer.

Messages

This widget posts no messages.

Bindings

This widget has no bindings.

Component Classes

The footer widget provides the following component classes:

Class Description
classic-footer--description Targets the descriptions of the key bindings.
classic-footer--highlight Targets the highlighted key binding.
classic-footer--highlight-key Targets the key portion of the highlighted key binding.
classic-footer--key Targets the key portions of the key bindings.

Additional Notes

  • You can prevent keybindings from appearing in the footer by setting the show argument of the Binding to False.
  • You can customize the text that appears for the key itself in the footer using the key_display argument of Binding.

textual.widgets.ClassicFooter class

def __init__(self):

Bases: Widget

A simple footer widget which docks itself to the bottom of the parent container.

COMPONENT_CLASSES class-attribute

COMPONENT_CLASSES: set[str] = {
    "footer--description",
    "footer--key",
    "footer--highlight",
    "footer--highlight-key",
}
Class Description
classic-footer--description Targets the descriptions of the key bindings.
classic-footer--highlight Targets the highlighted key binding.
classic-footer--highlight-key Targets the key portion of the highlighted key binding.
classic-footer--key Targets the key portions of the key bindings.

watch_highlight_key async

def watch_highlight_key(self):

If highlight key changes we need to regenerate the text.