vincent15000's avatar

x-slot not defined in blade component

Hello,

I have this code.

<x-modal x-show="showModal">
    <x-slot:title>sdkjfolgfd</x-slot>
        
    sdfgsdfgsdfg
</x-modal>

I really dont understand why x-slot is not defined.

I get this error message.

Unable to locate a class or view for component [slot:title]

Do you have any idea why ?

Thanks for your help.

V

0 likes
11 replies
webrobert's avatar

off the cuff... it doesn't like x-show? have you tried without it?

1 like
webrobert's avatar

sometimes I think my IDE (phpstorm) does weird things too. have to delete line and re add them. Not sure what is actually happening.

1 like
vincent15000's avatar

@webrobert Yes I have deleted all code relative to AlpineJS in the whole component and I still have the same error.

vincent15000's avatar

@webrobert Is it possible that I have this problem because I use the component inside a Livewire view ?

Lara_Love's avatar

You write code i blade like

<div>
hi
</div>

and use <x- component name >

is it your mean?

1 like
vincent15000's avatar

@LoverToHelp That's another way to create layouts with blade. I was used to use it, but now I prefer the blade components.

webrobert's avatar
Level 51

@vincent15000

I also use the old syntax if I want a one-liner

@slot('title', 'title') 

or when I want to breakup the code

1 like

Please or to participate in this conversation.