DEV Community

Mohamed Idris
Mohamed Idris

Posted on

In Laravel Blade components, should you pass content as slots or as attributes?

In Laravel Blade components, you can pass content as slots or as attributes.

For HTML content, it's clearer to pass it as slots because it indicates that the content is HTML and allows you to include HTML tags directly.

And, in the example below, if you pass the title as an attribute, it will also be used as the title of the div container tag which might be unexpected.

Image description

Top comments (0)