Skip to content

Multi-word blade component attributes aren't passed to child component #48956

Closed
@jacksleight

Description

@jacksleight

Laravel Version

10.31.0

PHP Version

8.2.11

Database Driver & Version

No response

Description

When passing multi-word blade component attributes to a child component they don't make it to the child component. Probably best explained with an example:

Steps To Reproduce

I have a blade component called foo:

@props([
    'one' => 'none',
    'twoWord' => 'none',
])
{{ $one }} {{ $twoWord }}

And I have another blade component called bar which simply wraps foo and passes everything down:

<x-foo :attributes="$attributes"></x-foo>

If I render these two components like this:

<x-foo one="ok" two-word="ok"></x-foo>
<x-bar one="ok" two-word="ok"></x-bar>

I would expect this output:

ok ok
ok ok

However instead I get:

ok ok
ok none

In both instances if I dump the attribute bag inside foo it's empty, which I would expect.

The two-word/$twoWord value just seems to disappear when passed via bar, but the one/$one value works fine.

Screenshot 2023-11-09 at 11 41 06

foo and bar are both anonymous components.

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