Get current tab from outside of infolist
I've got a blade file containing an infolist that uses the tabs component.
I want to be able to access the active tab name from outside of the infolist but I can't figure out a way to do this.
PHP livewire component
public function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema($this->getInfolistSchema());
}
private function getInfolistSchema()
{
return [
Tabs::make('Tabs')
->tabs([
Tab::make('Tab1')
->schema([
// tab 1 schema
]),
Tab::make('Tab2')
->schema([
// tab 2 schema
]),
])
->persistTabInQueryString()
->id('my-tabs'),
];
}
Parent Blade component
<div class="parentContainer">
Current tab is <!-- insert tab name here -->
<livewire:my-tabber/>
</div>
Child Blade component
<div class="childContainer">
{{ $this->infolist }}
</div>
0 Replies