JGuang

Hero Video Dialog

Hero Video Dialog · Magic UI

Preview
npx shadcn@latest add https://jiguang132.com/r/magic-ui/hero-video-dialog.json

Some upstream demos use online images, videos or tweets. That content depends on network access and third-party services.

Hero Video Dialog

Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/hero-video-dialog.json

Use case

Open a video from its thumbnail with an animated overlay.

Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

Owning component propExplanationExample source
HeroVideoDialog.className (hero-video-dialog)Classes on this native component; initialize Tailwind and its required CSS first.examples/hero-video-dialog-demo.tsx、examples/hero-video-dialog-demo-top-in-bottom-out.tsx
HeroVideoDialog.animationStyle (hero-video-dialog)Native video-dialog entrance/exit preset.examples/hero-video-dialog-demo.tsx、examples/hero-video-dialog-demo-top-in-bottom-out.tsx
HeroVideoDialog.videoSrc (hero-video-dialog)Video source; network, format and autoplay restrictions still apply.examples/hero-video-dialog-demo.tsx、examples/hero-video-dialog-demo-top-in-bottom-out.tsx
HeroVideoDialog.thumbnailSrc (hero-video-dialog)Video thumbnail image source.examples/hero-video-dialog-demo.tsx、examples/hero-video-dialog-demo-top-in-bottom-out.tsx
HeroVideoDialog.thumbnailAlt (hero-video-dialog)Meaningful alternative text for the thumbnail.examples/hero-video-dialog-demo.tsx、examples/hero-video-dialog-demo-top-in-bottom-out.tsx

Interaction and state checks

  • Hero Video Dialog Demo — hero-video-dialog-demo
  • Hero Video Dialog Top In Bottom Out Demo — hero-video-dialog-demo-top-in-bottom-out

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

Business integration boundary

videoSrc is an embedded video URL. Audit iframe permissions, Escape/close behavior, focus restoration and media failure; there is no hosting service.

Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.

Available examples

hero-video-dialog-demo, hero-video-dialog-demo-top-in-bottom-out

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Installation

<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
npx shadcn@latest add @magicui/hero-video-dialog
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Copy and paste the following code into your project.</Step>

<Step>Update the import paths to match your project setup.</Step>

</Steps> </TabsContent> </Tabs>

Examples

Top-in-bottom-out

Usage

import { HeroVideoDialog } from "@/components/ui/hero-video-dialog"
<HeroVideoDialog
  className="block dark:hidden"
  animationStyle="from-center"
  videoSrc="https://www.example.com/dummy-video"
  thumbnailSrc="https://www.example.com/dummy-thumbnail.png"
  thumbnailAlt="Dummy Video Thumbnail"
/>

Props

PropTypeDefaultDescription
animationStylestring"from-center"Animation style for the dialog
videoSrcstring-URL of the video to be played
thumbnailSrcstring-URL of the thumbnail image
thumbnailAltstring"Video thumbnail"Alt text for the thumbnail image

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

Note

  • If using a YouTube video, make sure to use the embed version of the video URL.

Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

Hero Video Dialog Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/hero-video-dialog/hero-video-dialog-demo.json

Default import: @/components/magicui/examples/hero-video-dialog-demo

Dependencies: clsx@2.1.1, lucide-react@1.24.0, motion@12.42.2, tailwind-merge@3.6.0

Hero Video Dialog Top In Bottom Out Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/hero-video-dialog/hero-video-dialog-demo-top-in-bottom-out.json

Default import: @/components/magicui/examples/hero-video-dialog-demo-top-in-bottom-out

Dependencies: clsx@2.1.1, lucide-react@1.24.0, motion@12.42.2, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/hero-video-dialog-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.

Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.

HeroVideoDialog({
  animationStyle = "from-center",
  videoSrc,
  thumbnailSrc,
  thumbnailAlt = "Video thumbnail",
  className,
}: HeroVideoProps)
type AnimationStyle =
  | "from-bottom"
  | "from-center"
  | "from-top"
  | "from-left"
  | "from-right"
  | "fade"
  | "top-in-bottom-out"
  | "left-in-right-out"

interface HeroVideoProps {
  animationStyle?: AnimationStyle
  videoSrc: string
  thumbnailSrc: string
  thumbnailAlt?: string
  className?: string
}

Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.

// HeroVideoDialog
animationStyle = "from-center"

// HeroVideoDialog
thumbnailAlt = "Video thumbnail"