Skip to content

Using $attributes-Bag on Flux:Modal-Component #17

@ThomasEnssner

Description

@ThomasEnssner

Describe the bug
After installing Blaze the FluxModal component causes a parse error if you use {{ $attributes->class('space-y-6') }} on the component "call".

my own component "x-livewire-modal" wraps the flux:modal for setting default layout like headlines and buttons and so on...

Component causing the issue

<!-- resources/views/components/livewire-modal.blade.php -->
@props(['heading' => null, 'buttons' => null])

<flux:modal wire:model.self="showModal" :name="$this->getName()" {{ $attributes->class(['space-y-6']) }}>
  <div>
    @if($heading)
      <flux:heading size="lg">{{ $heading }}</flux:heading>
    @endif
  </div>

  {{ $slot }}


  <div class="...somestyles...">
    @if (filled(trim((string) $buttons)))
      {{ $buttons }}
    @else
      <flux:modal.close>
        <flux:button variant="ghost">Schließen</flux:button>
      </flux:modal.close>
    @endif
  </div>
</flux:modal>

Expected behavior
Should work as there is no blaze installed.

Actual behavior

Environment

  • Laravel version: 12.
  • PHP version: 8.4
  • Flux (pro): 2.6.1,
  • Blaze: 1.0-beta1
  • Livewire: 3.6.4

Additional context
removing the {{ $attributes->class(['space-y-6']) }} addition would fix the parse-error.
But I use the class forwarding here to adjust the width of the modal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions