Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to pass a custom Svelte render component #47

Open
motin opened this issue Oct 15, 2024 · 1 comment
Open

Ability to pass a custom Svelte render component #47

motin opened this issue Oct 15, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@motin
Copy link

motin commented Oct 15, 2024

Similar to how custom html can be supplied, it'd be great to be able to supply a renderComponent attribute, when if defined it would be used instead of Image, Video, Iframe etc. This would make the usage more Sveltish for svelte apps using the library, and prevent one of having to prerender the html for all items upfront.

It'd be a small change, something like rendering the custom component if supplied:

				{#if activeItem.renderComponent}
					<svelte:component this={activeItem.renderComponent}  props={getChildProps()} {smallScreen} />
				{:else if activeItem.img}
@henrygd
Copy link
Owner

henrygd commented Oct 15, 2024

Good idea. I'm behind on other things so may not have time to look into it in the short term.

As an alternative, you can use an empty string with the html option and mount a component in onOpen. There's an example in the html section of the readme.

@henrygd henrygd added the enhancement New feature or request label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants