Hi Dato team!
According to your docs for your SvelteKit Structured Text component, itās possible to render special nodes within structured text. There is also an example in the docs:
<script>
import { isBlock, isInlineItem, isItemLink } from 'datocms-structured-text-utils';
import { StructuredText } from '@datocms/svelte';
import Block from './Block.svelte';
import InlineItem from './InlineItem.svelte';
import ItemLink from './ItemLink.svelte';
</script>
<StructuredText
data={blogPost.content}
components={[
[isInlineItem, InlineItem],
[isItemLink, ItemLink],
[isBlock, Block]
]}
/>
This works fine for me as long as I donāt need to pass any props to my Block.svelte. But how can I render this block when I need to pass any props to the component?
In my case, my āBlock.svelteā component is a simple button that receives a label prop. Something like this:
<!-- Block.svelte -->
<script lang="ts">
export let label: string
</script>
<button>{label}</button>
Thanks!
Nico