Hero Video Dialog
A hero video dialog component that opens a video player with configurable animations.
import { HeroVideoDialog } from '@/registry/magicui/hero-video-dialog'
export function HeroVideoDialogDemo() { return ( <div class="relative"> <HeroVideoDialog class=" block dark:hidden " animationStyle="from-center" videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb" thumbnailSrc="https://startup-template-sage.vercel.app/hero-light.png" thumbnailAlt="Hero Video" /> <HeroVideoDialog class=" hidden dark:block " animationStyle="from-center" videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb" thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png" thumbnailAlt="Hero Video" /> </div> )}Examples
Section titled “Examples”Top-in-bottom-out
Section titled “Top-in-bottom-out”import { HeroVideoDialog } from '@/registry/magicui/hero-video-dialog'
export function HeroVideoDialogDemoTopInBottomOut() { return ( <div class="relative"> <HeroVideoDialog class=" block dark:hidden " animationStyle="top-in-bottom-out" videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb" thumbnailSrc="https://startup-template-sage.vercel.app/hero-light.png" thumbnailAlt="Hero Video" /> <HeroVideoDialog class=" hidden dark:block " animationStyle="top-in-bottom-out" videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb" thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png" thumbnailAlt="Hero Video" /> </div> )}Installation
Section titled “Installation”pnpm dlx shadcn@latest add @magicui-solid/hero-video-dialogbunx shadcn@latest add @magicui-solid/hero-video-dialogyarn dlx shadcn@latest add @magicui-solid/hero-video-dialognpx shadcn@latest add @magicui-solid/hero-video-dialogImport
Section titled “Import”import { HeroVideoDialog } from '@/components/magicui/hero-video-dialog'<HeroVideoDialog animationStyle="from-center" videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb" thumbnailSrc="https://startup-template-sage.vercel.app/hero-light.png" thumbnailAlt="Hero Video"/>| Prop | Type | Default | Description |
|---|---|---|---|
animationStyle |
string |
"from-center" |
Animation style for the dialog |
videoSrc |
string |
- |
URL of the video to be played |
thumbnailSrc |
string |
- |
URL of the thumbnail image |
thumbnailAlt |
string |
"Video thumbnail" |
Alt text for the thumbnail image |
class |
string |
- |
Custom CSS class for styling. |
Animation Styles
Section titled “Animation Styles”The animationStyle prop accepts the following values:
"from-bottom": Dialog enters from the bottom and exits to the bottom"from-center": Dialog scales up from the center and scales down to the center"from-top": Dialog enters from the top and exits to the top"from-left": Dialog enters from the left and exits to the left"from-right": Dialog enters from the right and exits to the right"fade": Dialog fades in and out"top-in-bottom-out": Dialog enters from the top and exits to the bottom"left-in-right-out": Dialog enters from the left and exits to the right
- If using a YouTube video, make sure to use the
embedversion of the video URL.
Original:
magicui.design/docs/components/hero-video-dialog