Module: Plushie::UI

Defined in:
lib/plushie/ui.rb,
sig/plushie/ui.rbs

Overview

Block-based DSL for building UI trees.

Included automatically by App. All widget methods are private to avoid polluting the app's public interface.

Auto-IDs

Widgets without explicit IDs get auto-generated IDs derived from the call site (e.g. "auto:view:42"). These are unstable across code changes: any refactor that moves the call to a different line will change the ID. Always use explicit IDs for stateful widgets (+text_input+, text_editor, scrollable, combo_box, pane_grid).

Usage

def view(model)
window("main", title: "Counter") do
  column(padding: 16, spacing: 8) do
    text("count", "Count: #{model.count}")
    row(spacing: 8) do
      button("increment", "+")
      button("decrement", "-")
    end
  end
end
end

The DSL uses a thread-local context stack to track parent-child relationships. Blocks run in the caller's binding (no instance_eval), so self remains the app instance and private helpers work normally.

Defined Under Namespace

Modules: Context, MemoCache