Back

I have been working on Blade Components lately, specifically styling different elements from outside and this has been my experience.
1. I can't pass any attribute without having a slot present and imperatively have a closing tag.
2. I loose the simplicity and the clean feel that components provide.

image
image

4

35

0 / 1000

I would love to be able to just add attributes and slot values in the same component tag, just like in the picture.

image

1

So i set on a journey to make that happen and started by imagining how would i be able to structure such component, and found myself with the following version.

I would love to know your opinion about it.

image

1

The scope method is a ComponentAttributeBag Macro that i made to allow me to scope attributes to specific elements within the blade component, meaning any attribute prefixed with the name of a scope would be affected the element with that scope.

image

1