Skip to content

Tabs

final class Phui\Components\Tabs

A row of labels with the current one highlighted. Unlike the other selectable built-ins, selected is a plain prop rather than a model: Tabs has no keys of its own, so the parent moves the tab in response to change and to whatever bindings it declares itself. Takes no focus; it responds to clicks only.

Three tabs with the middle one current

php
use Phui\Components\Tabs;
use Phui\Events\EmitEvent;

Tabs::mount()
    ->props(tabs: ['Files', 'Search', 'Settings'], selected: $this->tab)
    ->on('change', fn (EmitEvent $e) => $this->tab = $e->data);

Props

PropTypeDefaultDescription
tabsstring[][]The tab labels.
selectedint0Index of the current tab.
separatorstring'/'Drawn between tabs.

Emits

EventPayloadEmitted when
changeintA tab is left-clicked.

Colours

Phui\Components\Colours\TabsColours

ColourPalette defaultUsed for
tabmutedTabs other than the current one.
tabSelectedaccentThe current tab, which is also bold.
separatorsurfaceThe separators between tabs.

Released under the MIT License.