Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top level components are not receiving parameter values #58

Closed
farez opened this issue Jul 29, 2023 · 2 comments
Closed

Top level components are not receiving parameter values #58

farez opened this issue Jul 29, 2023 · 2 comments
Assignees

Comments

@farez
Copy link

farez commented Jul 29, 2023

Folio Version

1.0.0-beta.1

Laravel Version

10.16.1

PHP Version

8.1

Description

Not sure if this is a bug or not, but if a view component is used inside a Folio page as the 'top level' component, e.g. as a layout component, parameters do not get passed to the component. But it does get passed through once it's nested inside another div.

E.g. this doesn't pass the title parameter:

<x-app-layout title="Videos">

   ...

</x-app-layout>

But this does:

<div>
    <x-app-layout title="Videos">
        
        ...

    </x-app-layout>
</div>

Steps To Reproduce

  1. Create a component that accepts a parameter and outputs it in the component.
  2. Use the component inside a Folio page as the top-level component. Pass along the parameter.
  3. Result: the parameter's value is not passed to the component.
  4. Now, in the Folio page, wrap the component with div tags.
  5. Refresh the output.
  6. Result: the parameter's value is now passed to the component.
@nunomaduro
Copy link
Member

nunomaduro commented Jul 31, 2023

You need to set your title like so:

<x-app-layout>
    <x-slot:title>
        Videos
    </x-slot>

    ...
</x-app-layout>

@farez
Copy link
Author

farez commented Aug 14, 2023

That works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants