X Enterprises
nuxt-x-affiliate

Video Modal

Click-to-play video in a modal — thumbnail with a play button that opens the video full-size.

Video Modal

A thumbnail with a play button that opens the video full-size in a modal.

Built on top of <XAFVideoEmbed>, so it inherits its YouTube/Vimeo/direct URL handling, the youtube-nocookie host, and VideoObject structured data. This component contributes the thumbnail trigger and the modal.

The embed is only mounted while the modal is open, so the iframe and everything the video host loads with it stay off the page until the visitor asks to watch.

Components

<XAFVideoModal />

<XAFVideoModal
  src="https://www.youtube.com/watch?v=xxxxxxxxxxx"
  title="How we test cordless drills"
  thumbnail="/covers/how-we-test.webp"
  description="A walkthrough of the testing bench."
/>

Props

PropTypeDefaultDescription
srcstringrequiredYouTube, Vimeo, or direct video URL
titlestringrequiredAccessible title for the video
thumbnailstring—Preview image. Without one, only a button renders
thumbnailAltstringtitleAlt text for the thumbnail
descriptionstring—Caption under the modal video
button{ label?, icon?, color?, variant?, size? }{}Trigger button, when there is no thumbnail
autoplaybooleantrueAutoplay (muted) once the modal opens
aspectRatiostring'16/9'Thumbnail and video aspect ratio

Events

EventPayloadDescription
open—Modal opened
close—Modal closed

Tips

  • Use <XAFVideoEmbed> directly for a video that should play inline in the article body. Use this when the video is supporting material and the iframe cost is not worth paying on page load.

AI Context

component: XAFVideoModal
package: "@xenterprises/nuxt-x-affiliate"
use-when: Click-to-play video behind a thumbnail, in a modal
Copyright © 2026