Skip to content

Rule

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

  • Focusable
  • Container

Examples

Horizontal Rule

The default orientation of a rule is horizontal.

The example below shows horizontal rules with all the available line styles.

HorizontalRulesApp solid (default) ──────────────────────────────────────────────────────────────── heavy ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ thick ████████████████████████████████████████████████████████████████ dashed ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ double ════════════════════════════════════════════════════════════════ ascii ----------------------------------------------------------------

from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Label, Rule


class HorizontalRulesApp(App):