Skip to content

Blade Component Attributes should not render when empty/whitespace-only #57463

Closed

Description

@NickSdot

Laravel Version

12

PHP Version

8.4

Database Driver & Version

No response

Description

While discussing #57235 I found that

 @php($foo = "")
 <x-link :title="$foo" >

renders as

<a title>

Personally, I believe that this is unexpected and that empty strings and whitespace-only strings should not render the attribute.

Opinions? Do we have any appetite to change this in L13?

Steps To Reproduce

Component:

<a {{ $attributes }}>Blub</a>

Activity

  1. locked and limited conversation to collaborators on Nov 12, 2025
  2. converted this issue into a discussion #57757 on Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions