Scrollbar #
PhpTui\Tui\Extension\Core\Widget\ScrollbarWidget
A widget to display a scrollbar
The following components of the scrollbar are customizable in symbol and style.
<--▮------->
^ ^ ^ ^
│ │ │ └ end
│ │ └──── track
│ └──────── thumb
└─────────── begin
Example #
Show code
<?php
declare(strict_types=1);
use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Widget\Scrollbar\ScrollbarState;
use PhpTui\Tui\Extension\Core\Widget\ScrollbarWidget;
require 'vendor/autoload.php';
$display = DisplayBuilder::default()->build();
$display->draw(
ScrollbarWidget::default()
->state(new ScrollbarState(30, 15, 5))
);
Parameters #
Configure the widget using the builder methods named as follows:
Name | Type | Description |
---|---|---|
orientation | PhpTui\Tui\Extension\Core\Widget\Scrollbar\ScrollbarOrientation | If this is a horizontal or a vertical scrollbar |
thumbStyle | PhpTui\Tui\Style\Style | Style for the thumb |
thumbSymbol | string | Symbol for the thumb |
trackStyle | PhpTui\Tui\Style\Style | Style for the track |
trackSymbol | string|null | Symbol for the track |
beginSymbol | string|null | Beginning symbol, e.g. 👈 |
beginStyle | PhpTui\Tui\Style\Style | Style for the beginning symbol |
endSymbol | string|null | Ending symbol, e.g. 👉 |
endStyle | PhpTui\Tui\Style\Style | Style for the ending symbol |
state | PhpTui\Tui\Extension\Core\Widget\Scrollbar\ScrollbarState | The state |