Skip to content

Label

Added in version 0.5.0

A widget which displays static text, but which can also contain more complex Rich renderables.

  • Focusable
  • Container

Example

The example below shows how you can use a Label widget to display some text.

LabelApp Hello, world!

from textual.app import App, ComposeResult
from textual.widgets import Label


class LabelApp(App):
    def compose(self) -> ComposeResult:
        yield Label("Hello, world!")


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

Reactive Attributes

This widget has no reactive attributes.

Messages

This widget posts no messages.

Bindings

This widget has no bindings.

Component Classes

This widget has no component classes.


textual.widgets.Label class

Bases: Static

A simple label widget for displaying text-oriented renderables.