Skip to content
sveltekit-embed
Everything else

GenericEmbed

An iframe for anything without its own component yet.

import { GenericEmbed } from 'sveltekit-embed';
Svelte
1<GenericEmbed
2	src="https://open.spotify.com/embed/show/4XPl3uEEL9hvqMkoZrzbx5"
3	title="Syntax on Spotify"
4	height="152px"
5	allow="encrypted-media"
6	style="border-radius: 0.9rem;"
7/>

Use this when a platform does not have its own component. It renders an iframe with the same lazy loading as the rest, and passes every other attribute you give it straight to the iframe.

Your own markup

Anything inside the component is rendered beside the iframe, for a caption or a fallback link.

Svelte
1<GenericEmbed src="https://example.com/embed/123" title="Example">
2	<a href="https://example.com/123">Open on example.com</a>
3</GenericEmbed>

Props

PropTypeDefault
src

The URL to embed.

string''
title

Describes the iframe to assistive technology.

string''
height

Any CSS height.

string'152px'
width

Any CSS width.

string'100%'
loading

lazy waits until the embed is near the viewport, eager loads it straight away.

'lazy' | 'eager''lazy'
children

Your own markup, rendered beside the iframe.

Snippet–
...rest

Every other attribute is passed to the iframe.

HTMLIframeAttributes–

Something wrong on this page? Edit it on GitHub.