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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay