← All libraries

SugarVeil

SugarVeil

Terminal overlay compositor

port of rmhubbert/bubbletea-overlay overlayteardownui

Stack overlay views on top of a base TUI. Each overlay renders independently and the compositor handles z-ordering, positioning, and teardown.

Install

composer require sugarcraft/sugar-veil

Quickstart

use SugarCraft\Veil\Veil;
use SugarCraft\Sprinkles\Style;

$veil = new Veil();
$veil = $veil->push($modalView, Position::Center);
$veil = $veil->push($tooltip, Position::TopRight);

echo $veil->render($baseView);

What's in the box

Stack managementPush / pop overlays. Z-order handled automatically.
PositioningCenter, Top, Bottom, Left, Right, or absolute coordinates.
TeardownPer-overlay completion callbacks on removal.

Source & demos

Try the quickstart →

API

ClassMethodDescription
Veilnew()Create a new veil
Veilpush(view, position)Push overlay onto stack
Veilpop()Pop top overlay
Veilrender(baseView)Composite all overlays

Demos.

VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.

Modal overlay

Modal overlay

Modal pinned over a background frame.
Multiple overlays

Multiple overlays

Stacked overlays composited in z-order.