[GH-ISSUE #7] [Feature] Svelte #5

Open
opened 2026-03-02 05:16:29 +03:00 by kerem · 3 comments
Owner

Originally created by @hej-julian on GitHub (Feb 16, 2026).
Original GitHub issue: https://github.com/hiaaryan/sileo/issues/7

Nice Project!

Make it compatible with Svelte for the future?

Originally created by @hej-julian on GitHub (Feb 16, 2026). Original GitHub issue: https://github.com/hiaaryan/sileo/issues/7 Nice Project! Make it compatible with Svelte for the future?
Author
Owner

@alexgipi commented on GitHub (Feb 16, 2026):

This would be wonderful! If supporting Svelte is in your plans and you need help, I could take care of it @hiaaryan!
Great work, by the way! 👏👏
Cheers!

<!-- gh-comment-id:3909976400 --> @alexgipi commented on GitHub (Feb 16, 2026): This would be wonderful! If supporting Svelte is in your plans and you need help, I could take care of it @hiaaryan! Great work, by the way! 👏👏 Cheers!
Author
Owner

@HorizonCode commented on GitHub (Feb 16, 2026):

until a proper Svelte port exists, you can use react and react-dom as a workaround. This approach already works in Svelte:

Create a SileoToast.svelte component and paste the following:

<script lang="ts">
	import { createElement } from 'react'
	import { createRoot } from 'react-dom/client'
	import type { SileoOptions } from 'sileo'

	let props: SileoOptions = $props()
	let rootEl: HTMLElement

	$effect(() => {
		const root = createRoot(rootEl)

		import('sileo').then(({ Toaster }) => {
			const sileo = createElement(Toaster, { ...props })
			root.render(sileo)
		})

		return () => root.unmount()
	})
</script>

<div bind:this={rootEl}></div>

Hopefully this helps until an official Svelte version becomes available :)

<!-- gh-comment-id:3910403346 --> @HorizonCode commented on GitHub (Feb 16, 2026): until a proper Svelte port exists, you can use react and react-dom as a workaround. This approach already works in Svelte: Create a `SileoToast.svelte` component and paste the following: ```svelte <script lang="ts"> import { createElement } from 'react' import { createRoot } from 'react-dom/client' import type { SileoOptions } from 'sileo' let props: SileoOptions = $props() let rootEl: HTMLElement $effect(() => { const root = createRoot(rootEl) import('sileo').then(({ Toaster }) => { const sileo = createElement(Toaster, { ...props }) root.render(sileo) }) return () => root.unmount() }) </script> <div bind:this={rootEl}></div> ``` Hopefully this helps until an official Svelte version becomes available :)
Author
Owner

@hej-julian commented on GitHub (Feb 17, 2026):

until a proper Svelte port exists, you can use react and react-dom as a workaround. This approach already works in Svelte:

Create a SileoToast.svelte component and paste the following:

Hopefully this helps until an official Svelte version becomes available :)

Great solution @HorizonCode, but I'm waiting for full support.

<!-- gh-comment-id:3914456381 --> @hej-julian commented on GitHub (Feb 17, 2026): > until a proper Svelte port exists, you can use react and react-dom as a workaround. This approach already works in Svelte: > > Create a `SileoToast.svelte` component and paste the following: > > <script lang="ts"> > import { createElement } from 'react' > import { createRoot } from 'react-dom/client' > import type { SileoOptions } from 'sileo' > > let props: SileoOptions = $props() > let rootEl: HTMLElement > > $effect(() => { > const root = createRoot(rootEl) > > import('sileo').then(({ Toaster }) => { > const sileo = createElement(Toaster, { ...props }) > root.render(sileo) > }) > > return () => root.unmount() > }) > </script> > > <div bind:this={rootEl}></div> > Hopefully this helps until an official Svelte version becomes available :) Great solution @HorizonCode, but I'm waiting for full support.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/sileo#5
No description provided.