This page features some examples of recursive Svelte components, i.e., components that render themselves. For more details how this is done, check out the corresponding blog post.
The code can be found on GitHub.