Skip to content

ReferenceIcons

Icons

The SVG icon sets used by the packaged skins, as React components, SVG strings, and the media-icon element

The icons the packaged skins render. Skin source added with the Shadcn registry imports its icons from these modules, and your own controls can use them too.

Each icon is available as an SVG string and by name through the <media-icon> element.

Import

Register <media-icon>:

import "@videojs/html/icons/element";

Or import SVG strings:

import { playIcon } from "@videojs/html/icons";

Icon sets

Three sets ship with the same icon names and different designs.

Set family SVG strings Used by
Default default @videojs/html/icons or @videojs/html/icons/default The default skins, such as <video-skin>
Neutral neutral @videojs/html/icons/neutral The neutral skins, such as <video-neutral-skin>
Compat compat @videojs/html/icons/compat The compat skins, such as <video-compat-skin>

Available icons

DefaultNeutralCompatNameExport
airplay-enter, default setairplay-enter, neutral setairplay-enter, compat setairplay-enterairPlayEnterIcon
airplay-exit, default setairplay-exit, neutral setairplay-exit, compat setairplay-exitairPlayExitIcon
captions-off, default setcaptions-off, neutral setcaptions-off, compat setcaptions-offcaptionsOffIcon
captions-on, default setcaptions-on, neutral setcaptions-on, compat setcaptions-oncaptionsOnIcon
cast-enter, default setcast-enter, neutral setcast-enter, compat setcast-entercastEnterIcon
cast-exit, default setcast-exit, neutral setcast-exit, compat setcast-exitcastExitIcon
check, default setcheck, neutral setcheck, compat setcheckcheckIcon
chevron, default setchevron, neutral setchevron, compat setchevronchevronIcon
fullscreen-enter, default setfullscreen-enter, neutral setfullscreen-enter, compat setfullscreen-enterfullscreenEnterIcon
fullscreen-exit, default setfullscreen-exit, neutral setfullscreen-exit, compat setfullscreen-exitfullscreenExitIcon
gear, default setgear, neutral setgear, compat setgeargearIcon
pause, default setpause, neutral setpause, compat setpausepauseIcon
pip-enter, default setpip-enter, neutral setpip-enter, compat setpip-enterpipEnterIcon
pip-exit, default setpip-exit, neutral setpip-exit, compat setpip-exitpipExitIcon
play, default setplay, neutral setplay, compat setplayplayIcon
quality, default setquality, neutral setquality, compat setqualityqualityIcon
restart, default setrestart, neutral setrestart, compat setrestartrestartIcon
seek, default setseek, neutral setseek, compat setseekseekIcon
speech, default setspeech, neutral setspeech, compat setspeechspeechIcon
speed, default setspeed, neutral setspeed, compat setspeedspeedIcon
spinner, default setspinner, neutral setspinner, compat setspinnerspinnerIcon
switches, default setswitches, neutral setswitches, compat setswitchesswitchesIcon
volume-high, default setvolume-high, neutral setvolume-high, compat setvolume-highvolumeHighIcon
volume-low, default setvolume-low, neutral setvolume-low, compat setvolume-lowvolumeLowIcon
volume-off, default setvolume-off, neutral setvolume-off, compat setvolume-offvolumeOffIcon

Element

<media-icon> renders a registered icon as its child <svg>, in the light DOM. It renders nothing when the name is not registered in the family.

Attribute Default Description
name — Icon name from the available icons, such as play
family default Icon set to read from, such as neutral
<media-play-button>
  <media-icon class="play-icon" name="play"></media-icon>
  <media-icon class="pause-icon" name="pause" family="neutral"></media-icon>
</media-play-button>

Each module below defines <media-icon> if it is not already defined:

Module Registers
@videojs/html/icons/element Every set, loading each one the first time a <media-icon> asks for its family
@videojs/html/icons/element/default The default set, up front
@videojs/html/icons/element/neutral The neutral set, up front
@videojs/html/icons/element/compat The compat set, up front

SVG strings

Each icon export from @videojs/html/icons, @videojs/html/icons/default, @videojs/html/icons/neutral, and @videojs/html/icons/compat is the icon’s SVG markup as a string; @videojs/html/icons also exports registerIcons. Importing them does not define <media-icon>.

import { playIcon } from "@videojs/html/icons";

button.innerHTML = playIcon;

registerIcons

registerIcons(family, icons) registers SVG strings under icon names for <media-icon> and defines the element if needed. Only the icons you import ship, which is how skin source from the Shadcn registry registers its icons. Registering into an existing family adds to it, and <media-icon> elements already in the page update.

import { pauseIcon, playIcon, registerIcons } from "@videojs/html/icons";

registerIcons("default", { play: playIcon, pause: pauseIcon });
registerIcons("brand", { play: '<svg viewBox="0 0 18 18">…</svg>' });
<media-icon name="play"></media-icon>
<media-icon name="play" family="brand"></media-icon>

Once a family has registered icons, <media-icon> renders only those for it, even when @videojs/html/icons/element is also imported. registerIcons throws when a different element is already defined as media-icon and does not support registration.

Styling

Icons use fill="currentColor", so they take the text color of their parent. They are drawn on an 18×18 grid and render most sharply at 18px or a whole multiple, such as 36px.

media-icon svg {
  width: 36px;
  height: 36px;
  color: white;
}

Accessibility

Every icon renders with aria-hidden="true". Give the surrounding control its accessible name. Built-in buttons, such as the play button, provide one automatically.