Scrollbar

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:

NameTypeDescription
orientationPhpTui\Tui\Extension\Core\Widget\Scrollbar\ScrollbarOrientationIf this is a horizontal or a vertical scrollbar
thumbStylePhpTui\Tui\Style\StyleStyle for the thumb
thumbSymbolstringSymbol for the thumb
trackStylePhpTui\Tui\Style\StyleStyle for the track
trackSymbolstring|nullSymbol for the track
beginSymbolstring|nullBeginning symbol, e.g. 👈
beginStylePhpTui\Tui\Style\StyleStyle for the beginning symbol
endSymbolstring|nullEnding symbol, e.g. 👉
endStylePhpTui\Tui\Style\StyleStyle for the ending symbol
statePhpTui\Tui\Extension\Core\Widget\Scrollbar\ScrollbarStateThe state