Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Givar's avatar
Level 1

Tailwind(flowbite) modals weird behaviour with livewire component

Hey all,

I'm having a real hard time using flowbite's modals with livewire. I have a blade view restaurants.index which is rendering the x-layout blade component who calls the <livewire:restaurants/> component and the modal for creating a new resource. (restaunts.index view code)

The <livewire:restaurants/> view component has the following code while, the Restaurants class component has the following inside :

    class Restaurants extends Component
    {
        use WithPagination;
        protected $restaurants;
        public $db_restaurants;
        public $categories;
        
        
        public function delete($id){
            
            Restaurant::find($id)->delete();
        }
        
        
        
        public function render()
        {
            $this->categories = Category::where('type', 'Restaurant')->get();
            $this->db_restaurants = Restaurant::all();
            $google_places_api = new PlacesApi(env('GOOGLE_MAPS_API_KEY'));
            $restaurantsGooglePlacesResponse =array();
            
            foreach($this->db_restaurants as $restaurant){
                $response= $google_places_api->placeDetails($restaurant->google_place_id);
                $details = $response['result'];
                $photo_reference = array_shift($details['photos'])['photo_reference'];
                $photo_url = $google_places_api->photo($photo_reference, $params= ['maxheight'=> 400, 'maxwidth'=> 400]);
        
                $details['photo_url'] = $photo_url;
                $details['internal_restaurant_id'] =  $restaurant->id;
                $details['internal_created_at'] = $restaurant->created_at;
                array_push($restaurantsGooglePlacesResponse, $details);
            }
            
            $this->restaurants = collect($restaurantsGooglePlacesResponse)->paginate(8);
          
            
            return view('livewire.restaurants', ['restaurants' => $this->restaurants]);
            
        }
    }

The issue that I'm facing is that, on the first page loading, each of the 3 modals is showing and working properly but when i perform a livewire action(example, deleting a record via the delete() method), modals eithor stop to work at all or, if they works, are not renderized properly(example, renderized on the top left corner of the page).

This seems to me a really weird bahoviour caused by livewire.

Do you have any idea of what can cause this issue and how to solve it? Thank you so much

0 likes
3 replies
anas_74's avatar

hey @givar do you find a solution to this problem cause I'm facing this problem too and can't solve it

santbohara's avatar

Try once adding "wire:ignore" in your modal's parent div.

Sajid92's avatar

navigate#dont-rely-on-domcontentloaded Use this

Please or to participate in this conversation.