class RatatuiRuby::Widgets::Shape::Label

A text label on a canvas.

Labels render text at specific coordinates in canvas space. Unlike shapes, labels are always rendered on top of all other canvas elements.

x

The x-coordinate in canvas space (Numeric).

y

The y-coordinate in canvas space (Numeric).

text

The text content (String or Text::Line).

style

Optional style for the text.

Examples

# Simple label
Shape::Label.new(x: 0, y: 0, text: "Origin")

# Styled label
Shape::Label.new(
  x: -122.4, y: 37.8,
  text: "San Francisco",
  style: Style.new(fg: :cyan, add_modifier: :bold)
)

# Label with Text::Line for rich formatting
Shape::Label.new(
  x: 0.0, y: 0.0,
  text: Text::Line.new(spans: [
    Text::Span.new(content: "Hello ", style: Style.new(fg: :red)),
    Text::Span.new(content: "World", style: Style.new(fg: :blue))
  ])
)