Skip to content
sveltekit-embed

Embed media in
your Svelte apps.

A collection of 21 embed components I use on a regular basis, packaged up for use: videos, podcasts, social posts and code. They work in Svelte files and in Markdown with mdsvex, which is how this site is written.

Install it

Edit the ID, the embed follows. All YouTube props

Install and use

Add the package to a SvelteKit project. It needs Svelte 5.29 or later.

Terminal
1pnpm add -D sveltekit-embed

Import the component you need and give it an ID or a link.

+page.svelte
1<script>
2	import { YouTube } from 'sveltekit-embed';
3</script>
4
5<YouTube youtube_id="dQw4w9WgXcQ" />

It works the same way in Markdown with mdsvex, which is how the pages on this site are written.

+page.md
1<script>
2	import { YouTube } from 'sveltekit-embed';
3</script>
4
5# My post
6
7<YouTube youtube_id="dQw4w9WgXcQ" />

Embeds load when they get close to the viewport. To change that, or to lazy load your own markup, read how lazy loading works.

Components

Missing one? Request an embed or use GenericEmbed.