Skip to content

Blade Components in Antlers mishandle kebab-cased attributes #14839

@clee-fma

Description

@clee-fma

Bug description

As per PR #12424, I've been moving a few of my antlers partials to Blade components.

But, I've noticed that when referencing them from Antlers, props were not being assigned correctly when using kebab-casing (which is the expected behavior when referencing blade components).

They do work when using matching camelCasing, though.

How to reproduce

Create a component under resources/views/components — let's go with comp.blade.php.

In that file:

@props(['someProp' => null ])

<div data-test="{{$someProp}}"></div>

In an antlers file:

{{ $foo = 'Test' }}
<x-comp :some-prop="$foo" />

What you'd expect:

<div data-test="Test"></div>

What you get:

<div data-test=""></div>

If you update the antlers file to use camelCase:

{{ $foo = 'Test' }}
<x-comp :someProp="$foo" />

you get:

<div data-test="Test"></div>

Logs

Environment

Environment
Laravel Version: 12.62.0
PHP Version: 8.3.30
Composer Version: 2.8.8
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: daily
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 7
License Key: Set
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 6.21.0 PRO

Statamic Addons
aryehraber/statamic-logbook: 4.0.0
eminos/statamic-tabs: 2.0.1
fmasites/fabtech-core: 6.6.6
jacksleight/statamic-bard-texstyle: 4.1.0
ryanmitchell/statamic-translation-manager: 3.1.1
statamic/seo-pro: 7.11.0
tfd/statamic-cloudinary: 1.5.0

Installation

Fresh statamic/statamic site via CLI

Additional details

This seems to be the same with non-anonymous components as well, but I haven't tested the behavior as extensively.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions