Skip to content

Passing conditional attributes to component #57123

@browner12

Description

@browner12

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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions