Skip to content

Nested Block Support #889

@spellew

Description

@spellew

Is your feature request related to a problem? Please describe.
There currently doesn't seem to be a way to compose blocks from other blocks. Is this on the roadmap? When building complex layouts, I want to create reusable child blocks (e.g. testimonial, product card, rating) and embed them inside parent blocks (e.g. grids, carousels, heroes). Without this I’m forced to duplicate HTML/CSS/JS or build large monolithic blocks that are difficult to maintain.

Describe the solution you'd like
Introduce a BlockField field type that allows selecting another block and rendering it inside a parent block as a true Svelte component. The nested block should:

  • Support full Svelte functionality (template logic, reactivity, scoped CSS)
  • Update live in preview when nested field values change
  • Render correctly in both preview and published (static/SSR) sites
  • Allow prop passthrough and optional overrides from the parent block

Example usage in a parent block:

<div class="product-grid">
  {#each products as product}
    <svelte:component this={product_card_block} {...product_card_props} />
  {/each}
</div>

Describe alternatives you've considered

  • {@html _rendered} injection – works for static HTML but loses Svelte logic and interactivity
  • Copy/paste block code – leads to duplication and poor maintainability

Additional context
I’ve attempted an initial implementation, but the main challenge appears to be compilation. Currently nested components are not reliably available during static generation, leading to build or hydration issues.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions