Class: RatatuiRuby::Widgets::Overlay
- Inherits:
-
Object
- Object
- RatatuiRuby::Widgets::Overlay
- Includes:
- CoerceableWidget
- Defined in:
- lib/ratatui_ruby/widgets/overlay.rb
Overview
Stacks widgets on top of each other.
Terminal interfaces are 2D grids, but complex UIs require depth. You need to float modals over text, or place a status bar on top of a map.
This widget manages the Z-axis. It renders a list of widgets sequentially into the same area. Later widgets draw over earlier ones (Painter’s Algorithm).
Use overlays to compose complex scenes. Combine backgrounds, main content, and floating elements.
Examples
– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++
Overlay.new(
layers: [
BackgroundMap.new,
StatusBar.new, # Draws over map
ModalDialog.new # Draws over everything
]
)
– SPDX-SnippetEnd ++
Instance Method Summary collapse
-
#initialize(layers: []) ⇒ Overlay
constructor
Creates a new Overlay.
Methods included from CoerceableWidget
Constructor Details
#initialize(layers: []) ⇒ Overlay
Creates a new Overlay.
- layers
-
Array of widgets.
50 51 52 |
# File 'lib/ratatui_ruby/widgets/overlay.rb', line 50 def initialize(layers: []) super end |