Hide/Show Component/Section when tab is active #15115
-
PackagePanel builder Package Versionv3.0 How can we help you?I have two problems : 2-As you can see the tab parameter in the URL is being shown with a prefix '-' and a suffix '-tab', how can control this ? `
|
Beta Was this translation helpful? Give feedback.
Answered by
leandrocfe
Dec 18, 2024
Replies: 1 comment 1 reply
-
try this Section::make()
->schema([])
->visible(fn (Page $livewire): bool => $livewire->tab === '-tab1-tab'),
Tabs::make('Tabs')
->extraAlpineAttributes(['x-effect' => '$dispatch(\'update-tabs\', { tab: tab })'])
->tabs([
Tabs\Tab::make('Tab1')
->schema([]),
Tabs\Tab::make('Tab2')
->schema([]),
])
->activeTab(1)
->persistTabInQueryString(), YourPage.php (Create, Edit..) use Livewire\Attributes\On;
...
public $tab = null;
#[On('update-tabs')]
public function updateTabs($tab): void
{
$this->tab = $tab;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jandomos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try this
YourPage.php (Create, Edit..)