Active Tab in modal

I’m creating a new component. I have to display an image and clicking on it I have to open a modal window with a tab to create a gallery. I can’t get tab1 to open by default
...<x-filament::tabs>
<x-filament::tabs.item alpine-active="$wire.activeTab == '1'"
wire:click="$set('activeTab', '1')">
1
</x-filament::tabs.item>
@php
$conta = 2;
@endphp
@foreach ($getRecord()->articoli->foto as $image)
@if ($image->is_default == false)
<x-filament::tabs.item alpine-active="$wire.activeTab == '{{ $conta }}'"
wire:click="$set('activeTab', '{{ $conta }}')">
{{ $conta }}
</x-filament::tabs.item>
@php
$conta = $conta + 1;
@endphp
@endif
@endforeach
</x-filament::tabs>
<div x-show="$wire.activeTab == '1'">
<img id="{{ $getRecord()->articoli->foto[0]->filename }}"
src="{{ asset(Storage::url('article_images/' . $getRecord()->articoli->codart . '/' . $getRecord()->articoli->foto[0]->filename)) }}"
alt="{{ $getRecord()->articoli->foto[0]->filename }}">
</div>
@php
$conta = 2;
@endphp
@foreach ($getRecord()->articoli->foto as $image)
@if ($image->is_default == false)
<div x-show="$wire.activeTab == '{{ $conta }}' ">
<img id="{{ $image->filename }}"
src="{{ asset(Storage::url('article_images/' . $getRecord()->articoli->codart . '/' . $image->filename)) }}"
alt="{{ $image->filename }}">
</div>
@php
$conta = $conta + 1;
@endphp
@endif
@endforeach
</x-filament::modal>
...<x-filament::tabs>
<x-filament::tabs.item alpine-active="$wire.activeTab == '1'"
wire:click="$set('activeTab', '1')">
1
</x-filament::tabs.item>
@php
$conta = 2;
@endphp
@foreach ($getRecord()->articoli->foto as $image)
@if ($image->is_default == false)
<x-filament::tabs.item alpine-active="$wire.activeTab == '{{ $conta }}'"
wire:click="$set('activeTab', '{{ $conta }}')">
{{ $conta }}
</x-filament::tabs.item>
@php
$conta = $conta + 1;
@endphp
@endif
@endforeach
</x-filament::tabs>
<div x-show="$wire.activeTab == '1'">
<img id="{{ $getRecord()->articoli->foto[0]->filename }}"
src="{{ asset(Storage::url('article_images/' . $getRecord()->articoli->codart . '/' . $getRecord()->articoli->foto[0]->filename)) }}"
alt="{{ $getRecord()->articoli->foto[0]->filename }}">
</div>
@php
$conta = 2;
@endphp
@foreach ($getRecord()->articoli->foto as $image)
@if ($image->is_default == false)
<div x-show="$wire.activeTab == '{{ $conta }}' ">
<img id="{{ $image->filename }}"
src="{{ asset(Storage::url('article_images/' . $getRecord()->articoli->codart . '/' . $image->filename)) }}"
alt="{{ $image->filename }}">
</div>
@php
$conta = $conta + 1;
@endphp
@endif
@endforeach
</x-filament::modal>
1 Reply
Marco Mapelli
Marco MapelliOP12mo ago
I can not. Opening a tabs in a modal window I can not put by default the first tab.
Want results from more Discord servers?
Add your server