Paragraph

Paragraph #

PhpTui\Tui\Extension\Core\Widget\ParagraphWidget

This widget has the ability to show and wrap text.

Example #

Show code
<?php

declare(strict_types=1);

use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Widget\ParagraphWidget;
use PhpTui\Tui\Text\Text;

require 'vendor/autoload.php';

$display = DisplayBuilder::default()->build();
$display->draw(
    ParagraphWidget::fromText(
        Text::fromString(
            <<<'EOT'
                Once upon a midnight weary,
                While I pondered weak and weary,
                Over many a quaint and curious volume of forgotten lore.
                EOT
        )
    )
);

Parameters #

Configure the widget using the builder methods named as follows:

NameTypeDescription
stylePhpTui\Tui\Style\Style
wrapPhpTui\Tui\Extension\Core\Widget\Paragraph\Wrap
textPhpTui\Tui\Text\Text
scrollarray
alignmentPhpTui\Tui\Widget\HorizontalAlignment