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

Slot support #1

Open
sjelfull opened this issue Mar 1, 2021 · 1 comment
Open

Slot support #1

sjelfull opened this issue Mar 1, 2021 · 1 comment

Comments

@sjelfull
Copy link

sjelfull commented Mar 1, 2021

Have you considered adding slots to the atoms?

@Tam
Copy link
Member

Tam commented Jun 8, 2023

I come from the React world, so don't have much experience with slots. How do you see it working?

You can do something like this, which might be similar:

{# Contents of `_atoms/my-atom` #}
<div>
    <h1>{{ slot }}</h1>
    {{ children }}
</div>

{# Contents of a template #}
{% set slot %}
    Slot content
{% endset %}

{% x:my-atom { slot: slot } %}
    Child content
{% endx:my-atom %}

{# Output #}
<div>
    <h1>Slot content</h1>
    Child content
</div>

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