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.
I would love to be able to just add attributes and slot values in the same component tag, just like in the picture.
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.
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.
I am looking for validation regarding this idea and probably even some advice.
I have even created a small package for it if you somehow find it interesting.
github.com/abdelhamiderrahmouni/blade-component-scopes