framework icon indicating copy to clipboard operation
framework copied to clipboard

Passing conditional attributes to component

Open browner12 opened this issue 2 months ago • 23 comments

Laravel Version

12.28.1

PHP Version

8.4.11

Database Driver & Version

NA

Description

I know we can pass attributes to components:

<x-card disabled><</x-card>

but it seems we cannot pass conditional attributes to components:

<x-card {{ $conditional ? '' : 'disabled' }}></x-card>

This results in a compilation error of "syntax error, unexpected token "endif", expecting end of file".

Is there another way to handle this, or do we need to adjust the regex to handle this?

Steps To Reproduce

<x-card {{ $conditional ? '' : 'disabled' }}></x-card>

browner12 avatar Sep 19 '25 20:09 browner12