Skip to content
docsv0.9.0

BadgeRenderer

Compact status pill: `[label]`, the TUI analog of a badge chip in a web UI. Single-line by design; the label is truncated to fit the node width minus the brackets so the closing `]` is never dropped. ── EL COLOR NO SE APLICA AQUÍ, Y NO SALE DE LOS PROPS ────────────────────── Lo pone `TuiAnsiPainter` al final, y lo DEDUCE del texto entre corchetes: `ready`/`done` → success, `error`/`failed` → error, `claude|gpt|gemini` → azul, el resto → accent. Este renderer emite texto plano, como toda la capa (*«TuiString's contract is plain text, not styled output»*). La versión anterior de este bloque decía que el pintor «toma el `role` de los props». Era falso, y costó: quien fue a implementar el color por actor buscó un camino que no existe. Una descripción que promete un mecanismo inexistente es peor que ninguna — la ausencia se nota, la mentira no. Props: - `label` string Texto de la píldora. Default: ''. - `fill` string Relleno del contorno. Default: 'square'.

BadgeRenderer::supports()

public function supports(Milpa\Live\ValueObjects\Tui\TuiNode $node): bool

True only for `badge` nodes — dispatch is by declared node type, never by where the node came from.

Parameters

Parameters of supports()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode

BadgeRenderer::render()

public function render(Milpa\Live\ValueObjects\Tui\TuiNode $node, Milpa\Live\ValueObjects\Tui\TuiRenderContext $context): Milpa\Live\ValueObjects\Tui\TuiFrame

Draws the pill on one line, colouring it by the node's semantic role.

Parameters

Parameters of render()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode
$contextMilpa\Live\ValueObjects\Tui\TuiRenderContext