Live preview

Interactive example

Loading example…

Usage

Import the component and its manager, then make it your own.

ComponentYouTubeVideo
Managercreate_youtube_video_manager

svelte

<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { YouTubeVideo, create_youtube_video_manager } from "sveltekit-ui"

  const manager = create_youtube_video_manager({
    video_id: "aqz-KE-bpKQ",
    is_dark_theme: false,
  })
</script>

<div style="max-width: 72rem;">
  <YouTubeVideo {manager} />
</div>

API reference

Configure the manager, call its methods, and read its reactive state.

3 entries in configuration

PropertyTypeDefaultDescription
idstring or null generated unique IDA unique identifier for the YouTubeVideo component. If not provided, a unique ID is generated automatically.
video_idstring nullThe unique identifier of the YouTube video to embed. This is required for rendering the video.
is_dark_themeboolean falseDetermines the theme of the embedded video. If true, applies a dark theme; otherwise, a light theme is used.