Declaration tags #2721
maxffarrell
started this conversation in
Ideas
Replies: 1 comment
|
Not necessarily. I had the same idea at first, but <script>
import { Card, cardHeader, cardTitle, cardContent, cardDescription, cardFooter } from "$lib/components/ui/card.svelte";
</script>
<Card> <!-- this is fine so far... -->
{@render cardHeader(title1)}
{#snippet title1()}
{@render cardTitle(title2)}
{#snippet title2()}
Hello, <b>world!</b>
{/snippet}
{/snippet}
{@render cardContent(content)}
{#snippet content()}
{@render cardDescription(description)}
{#snippet description}
This is the <i>description</i> of the card.
{/snippet}
{/snippet}
{@render cardFooter(footer)}
{#snippet footer()}
This is the footer, yet again
{/snippet}
</Card>and this is all before you get into state, multiple different components nested inside one another, etc etc etc. Snippets are very clearly designed to work inside one component, and not to be exported out for use by others. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Do declaration tags give us the ability to migrate to single file components or am I misunderstanding Rich's post?
All reactions