GuideGetting Started
Shadcn Installation Guide
Add editable React or HTML skin source with the Shadcn registry
Use Shadcn to add a Video.js skin's components, layout, styles, and interactions as React or HTML custom-element source. The CLI copies the files into your app so you can review and change them like any other source code.
AI Quickstart
Paste this prompt into your coding agent:
Install the Video.js skill: run `npx @videojs/cli agents skills` and follow the steps for the agent you are running in. If you can't run commands, follow the install instructions at https://github.com/videojs/skills instead. Then use the Video.js skill when you work on video or audio in this project. When installation details are needed, run `npx @videojs/cli agents init --method shadcn --framework react` for React, or `npx @videojs/cli agents init --method shadcn --framework html` for plain HTML. The command prints version-matched choices and instructions without changing files.Installation options for coding agents
The web Markdown page contains the default installation. Add the query parameters below to its .md URL for a complete, validated variation. From a project or an offline docs bundle, run the CLI command below instead. Both paths use the same installation renderer and only return instructions; they do not modify a project.
This page fixes the installation method to shadcn. The framework query parameter selects React or HTML.
npx @videojs/cli agents initQuery parameters
framework: The application framework that will host the player. React installs @videojs/react; HTML, Vue, and Svelte install @videojs/html. Values:react,html. Default: react.project: Whether to adapt the current project or scaffold a new one. New projects need a named app setup. Values:new,existing. Default: existing.preset: The player configuration and control set. Values:video,audio,live-video,live-audio. Default: video.skin: The visual skin. Minimal has cleaner surfaces and the same controls as Default. Values:default,minimal. Default: default. Applies when preset is not background-video.media: The media source or playback adapter. See the preset compatibility map below. Values:background-video,hls-background-video,cloudflare,dash,hls,html5-audio,html5-video,mux-audio,mux-background-video,mux-video,spotify,tiktok,twitch,vimeo,youtube. Default: the selected preset's first compatible media source.extensions: A comma-separated list of optional player extensions compatible with the selected player. Passnonewhen no extension is needed. Values:none,google-cast,mux-data. Default: mux-data for Mux media; none otherwise (reported as defaulted).source-url: The http:// or https:// media URL placed in the generated player example. Passdemoto choose the Video.js demo source for the selected media explicitly. Default: the Video.js demo source for the selected media (reported as defaulted).package-manager: The command runner used for app setup, packages, Shadcn, and the development server. Values:npm,pnpm,yarn,bun. Default: pnpm. Applies when method is not cdn with template none.template: The app setup and file layout. Values:next,vite,start,react-router,astro,laravel. Default: next for React; vite otherwise.styling: The Shadcn source styling. Compatible values depend on the framework. Values:tailwind,css. Default: tailwind for React; css otherwise. Applies when method=shadcn.
Run the command above without flags to see the corresponding CLI flags for every framework.
Decide in this order
- Inspect the project. Read package.json, framework config, and lockfiles to infer the framework, app setup, and package manager. React installs @videojs/react; HTML, Vue, and Svelte install @videojs/html.
- Choose the starting point. Use existing when adapting a compatible project. Use new only when the user wants a new app or the intended workspace has no app. Confirm the choice when the workspace and request do not make it clear.
- Choose the player. Use video unless the request signals another experience: audio, music, or podcasts use audio; a live stream uses live-video or live-audio; a muted, looping decorative video uses background-video. Ask only when those signals conflict.
- Choose the skin. Use default unless the request asks for a minimal, cleaner, or more subtle look, which uses minimal; both contain the same controls. Ask only when those signals conflict.
- Choose the media. Infer the adapter from the source when possible. Mux wins for Mux playback URLs: stream.mux.com/<playback-id>.m3u8 or a bare playback ID uses mux-video, mux-audio, or mux-background-video rather than hls. Mux static renditions such as .mp4 or .m4a files use html5-video or html5-audio. Other .m3u8 URLs use hls.
- Choose extensions. Mux Data is included by default for Mux video and audio sources. Add Google Cast when a standard or live video player with a ready-made skin should cast a compatible source. Use none when no extension is needed.
- Choose how to install. This guide uses Shadcn to copy editable skin source. React uses the React source catalog; plain HTML uses the HTML source catalog. Vue and Svelte use packaged modules.
- Choose the styling. For React, use tailwind in a new app or an existing Tailwind app; otherwise use css. HTML source uses css.
- Return one explicit plan. Confirm the choices once, then pass every applicable query parameter, including
extensions=nonewhen no extension is needed andsource-url=demowhen there is no media URL yet. Check that Defaulted options says none. Adapt conditional setup steps and existing paths before changing files.
Compatible media sources by preset
video:html5-video,hls,dash,mux-video,vimeo,youtube,cloudflare,tiktok,twitchaudio:html5-audio,mux-audio,spotifylive-video:hls,mux-videolive-audio:mux-audio
App setup and Shadcn styling by framework
react: templatesnext,vite,start,react-router,astro,laravel; stylingtailwind,csshtml: templatesvite,astro,laravel; stylingcss
Installation pages
Choose your framework
Choose the JavaScript framework for your project.
Choose your app
Choose the app environment that controls the setup commands and file locations below.
HTML
Choose your use case
Choose the ready-made player that is closest to what you are building. The Shadcn registry does not currently provide the background video skin as source.
Choose your media
Choose what the player will play. If that source needs a playback adapter, the installation steps include it.
Optional. The URL also ends up in your generated code.
Choose your extensions
Add optional behavior to the player. Only extensions that work with your player and media source appear below.
No optional extensions apply to these selections.
Choose how to install
Choose from the installation options available for your selections.
Prepare your app
Choose whether to create the selected app setup or add editable skin source to a project you already have.
Configure Shadcn
React
If components.json already exists, keep its aliases and skip this section. Otherwise, complete the setup below. The registry uses aliases.components for skin source. In a monorepo, run commands from the app workspace or pass --cwd <path>.
For a new React and Tailwind app, the rendered command creates a Next.js app. To use another project template, pass --template with one of vite (Vite), start (TanStack Start), react-router (React Router), astro (Astro), laravel (Laravel), and replace the --name value with the intended app directory. For an existing compatible app without components.json, run Shadcn init without the template and name flags after satisfying its Tailwind and import-alias checks.
When using Vanilla CSS or HTML, create the rendered standard components.json instead of running a React-oriented Shadcn initializer. Preserve existing aliases when that file already exists.
HTML
If components.json already exists, keep its aliases and skip this section. Otherwise, complete the setup below. The registry uses aliases.components for skin source. In a monorepo, run commands from the app workspace or pass --cwd <path>.
Configure tsconfig.json
Configure vite.config.ts
Create components.json
When using Vanilla CSS or HTML, create the rendered standard components.json instead of running a React-oriented Shadcn initializer. Preserve existing aliases when that file already exists.
Add the skin source
Configure @videojs, then add the selected skin source. Shadcn skips existing namespaces, so when you change styling or theme, replace the existing @videojs URL in components.json with the URL shown in the first step. Adding the skin overwrites an existing Video.js skin so the selected catalog applies completely. Review and remove obsolete Video.js style files left by an earlier catalog. For HTML source, repeat the media replacement below after an overwrite.
React
Add the Video.js Registry
Add the skin source
Create components.json (optional)
Add the Video.js Registry
Add the skin source
These instructions use shadcn registry add to select the Default Video skin catalog with Tailwind CSS, then add its source. Shadcn skips a namespace that is already configured, so replace the existing @videojs URL in components.json before the add command when changing catalogs. Use the matching catalog URL:
| Styling | Default skin (default) | Minimal skin (minimal) |
|---|---|---|
Tailwind CSS (tailwind) | https://shadcn.videojs.org/r/react/{name}.json | https://shadcn.videojs.org/r/react/minimal/{name}.json |
Vanilla CSS (css) | https://shadcn.videojs.org/r/react/css/{name}.json | https://shadcn.videojs.org/r/react/css/minimal/{name}.json |
Then add the item for your use case: @videojs/video, @videojs/audio, @videojs/live-video, or @videojs/live-audio.
The files are added under <components alias>/videojs/<preset>. The registry item also installs @videojs/react.
HTML
Add the Video.js Registry
Add the skin source
These instructions use shadcn registry add to select the Default Video skin catalog with Vanilla CSS, then add its source. Shadcn skips a namespace that is already configured, so replace the existing @videojs URL in components.json before the add command when changing catalogs. Use the matching catalog URL:
| Styling | Default skin (default) | Minimal skin (minimal) |
|---|---|---|
Vanilla CSS (css) | https://shadcn.videojs.org/r/html/{name}.json | https://shadcn.videojs.org/r/html/minimal/{name}.json |
Then add the item for your use case: @videojs/video, @videojs/audio, @videojs/live-video, or @videojs/live-audio.
The files are added under <components alias>/videojs/<preset>. The registry item also installs @videojs/html.
Add your player
React
Add the player to the file shown for your selected app setup. It imports the player and media from the package, then imports the selected skin from your project.
HTML
The steps below add HTML skin source to a plain HTML app. For Vue or Svelte, use the packaged skins in the Vue guide or Svelte guide.
Update the skin markup
The skin path below assumes the
@/componentscomponents alias. Ifaliases.componentsincomponents.jsondiffers, the skin is under that alias's directory instead.In
src/components/videojs/video/skin.html, replace the “Add a compatible media element here” comment with:Then size the video on the skin's root container: replace its opening
<media-containerwith:Register custom elements
Create
src/player.tsand import the player, media, and installed skin:Use the
aliases.componentsvalue fromcomponents.jsonin the skin import when it differs from@/components.Add the player to your page
Paste the updated skin markup inside the player, then load the entry module:
Run your app
Start the app and verify that the selected media plays.
That’s it! You now have a working Video.js player whose skin source lives in your project.
Change the skin source
React
Start in <components alias>/videojs/<preset>/skin.tsx. Follow the Customize skins guide for the files that control layout, colors, controls, and interactions.
HTML
Start in <components alias>/videojs/<preset>/skin.html. Follow the Customize skins guide for the files that control layout, colors, controls, and interactions.
