Skip to content
docsv0.3.0

TuiComponentInstance

One mounted Live component as seen by the terminal: pairs the component definition with the state snapshot it was mounted with, so a renderer can paint it without reaching back into the component registry.

TuiComponentInstance::__construct()

public function __construct(string $id, Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component, Milpa\Live\ValueObjects\ComponentContext $context, array $props = [], ?Milpa\Live\ValueObjects\StateSnapshot $state = null, int $cursor = 0):

Parameters

Parameters of __construct()
NameTypeDescription
$idstring
$componentMilpa\Live\Contracts\Component\ComponentDefinitionInterface
$contextMilpa\Live\ValueObjects\ComponentContext
$propsarray<string, mixed>
$state?Milpa\Live\ValueObjects\StateSnapshot
$cursorint

TuiComponentInstance::componentName()

public function componentName(): string

The contract name of the mounted component.

TuiComponentInstance::mountedState()

public function mountedState(): Milpa\Live\ValueObjects\StateSnapshot

The state snapshot this instance was mounted with.