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)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay