Can I use @component inside my blade templates in Sage 9?

Hi!
I’m doing my first big project with sage 9. I’m trying to use the @component directive inside my templates. For that, I created the views/components folder and I’m trying to call the component inside the template by using @component('components.my-component') but is not working.

Am I missing something here? Is there anything I should setup before using it?

1 Like

@component works as expected.

components/notification.blade.php

<div class="notification {{ $type or 'is-primary' }}">
  <button class="delete"></button>
  {{ $slot }}
</div>

Use in a view:

@component('components.notification')
  This is a notification!
@endcomponent
2 Likes

What about aliasing as described here: https://laravel.com/docs/5.6/blade#components-and-slots
Where does the config for that go in Sage?

1 Like

As far as I can tell, there is currently no easy way (i.e. following the posted documentation) to alias Blade components in Sage right now. Sage only just recently bumped Laravel to 5.6. There is some related conversation here: