Skip to content
Discussion options

You must be logged in to vote

Just to be clear, here are the docs for the #[slot] macro. It is used to allow you to provide some kind of typed as a prop to another component, and to build that data using the component syntax itself.

It doesn't have anything to do with conditionality in itself, that is just the example given. It is mostly a syntax sugar: in the example you're referring to, writing

        <SlotIf cond=is_even>
            // The slot name can be emitted if it would match the slot struct name (in snake case).
            <Then slot>"even"</Then>
            // Props are passed just like on normal components.
            <ElseIf slot cond=is_div5>"divisible by 5"</ElseIf>
            <ElseIf slot cond=is…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by maartensson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants