Skip to content

Instantly share code, notes, and snippets.

Pass Alpine.js Bound Attributes To Blade Component

If you need to pass a bound Alpine.js attribute to a Laravel Blade component, you can prefix the attribute name with two colons instead of a single colon to tell Blade to not evaluate the attribute as a PHP expression.

<div x-data="{ isActive: true }">
    <x-some-blade-component ::is-active="isActive" />
</div>