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

Props ? #29

Open
chrisvidal opened this issue Jan 8, 2025 · 1 comment
Open

Props ? #29

chrisvidal opened this issue Jan 8, 2025 · 1 comment

Comments

@chrisvidal
Copy link

Is there a way to use the equivalent to blade props ?

like this

@props([
    'badge' => null,
    'badgeColor' => 'primary',
])
@giorgiopogliani
Copy link
Owner

Yes, I also wanted something like this. I haven't got the time to do it sadly. I think it could work like this:

{% props { 'badge': null } %}

And basically it will avoid outputting attributes on the tags when printing and also provide some default. If you care only about defaults you could workaround like this:

{% set badge = badge ?? 'some default' %} 
{# or #}
{% set badge = badge|default('some defualt') %} 

But it will still output all attributes on the tags when doing {{ attributes }} unless you do something like this {{ attributes.except('badge') }}

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

No branches or pull requests

2 participants