Looking for the old docs? Go here

Layouts

Default Layout

A guide on how to setup the default audio/video layout and available customization options.

The Default Layout ships with support for audio, video, and live streams. You can include both layouts at the same time, only one will be matched depending on the view type.

    
    

By default, the view type is inferred from the provider and media type. You can specify the desired type like so:

    
    

The same is true for the stream type:

    
    

Both the audio and video layout accept color scheme to be either light or dark themed. By default it will use the user’s preferred color scheme. You can set a specific theme by setting the colorScheme prop on the layout like so:

    
    

You can also set the color scheme by setting a light or dark class on a parent element:

    
    

Both the audio and video layout will adapt to small containers to ensure an optimal user experience. You configure when the small layout is displayed like so:

    
    

If you’d like to disable small layouts, set the query to false or 'never':

    
    

You can easily replace the icons used in the layouts to match the style of your application like so:

tsx
    
    
    
    

You can provide thumbnails which will be used to display preview images when interacting with the time slider and in the chapters menu. See the loading thumbnails guide for more information.

    
    

Both the audio and video layout support internationalization (i18n) by accepting custom language translations. You can dynamically set the translations property to update the language like so:

ts
    
    
    
    

The following snippets contain a complete list of CSS variables and their respective default values. They can all be adjusted by you to customize the audio/video layout and child components as desired.

The following variables can be used to specifically customize the audio layout. See the Components section for more.

css
    
    

The following variables can be used to specifically customize the video layout. See the Components section for more.

css
    
    
css
    
    

The slots prop can be used to insert or replace content inside the DefaultAudioLayout. You can find all available slot positions below.

tsx
    
    

The slots prop can be used to insert or replace content inside the DefaultVideoLayout. You can find all available slot positions below.

tsx
    
    

Content can be slotted inside specific video layout sizes like so:

tsx
    
    

The following slot positions are available for inserting or replacing content:

  • bufferingIndicator
  • captionButton
  • captions
  • title
  • chapterTitle
  • currentTime
  • endTime
  • fullscreenButton
  • liveButton
  • livePlayButton
  • muteButton
  • pipButton
  • airPlayButton
  • googleCastButton
  • playButton
  • loadButton
  • seekBackwardButton
  • seekForwardButton
  • startDuration
  • timeSlider
  • volumeSlider
  • chaptersMenu
  • settingsMenu
  • settingsMenuStartItems
  • settingsMenuEndItems
INFO

Any slot position can be prefixed with either before or after to insert content before or after that position. For example, afterCaptionButton will insert content after the caption button.

The following demos show how the Default Layout adapts to audio, video, and live streams:

HTMLAttributes

The audio layout is our production-ready UI that's displayed when the media view type is set to 'audio'. It includes support for audio tracks, slider chapters, captions, live streams and more out of the box.

import { DefaultAudioLayout } from "@vidstack/react/player/layouts/plyr";
<MediaPlayer src="audio.mp3">
  <MediaProvider />
  <DefaultAudioLayout icons={defaultLayoutIcons} />
</MediaPlayer>
PropTypeDefault
children
ReactNode
null
icons
DefaultLayoutIcons
undefined
colorScheme
string
undefined
download
FileDownloadInfo
undefined
showTooltipDelay
number
700
showMenuDelay
number
0
hideQualityBitrate
boolean
false
smallLayoutWhen
any
`({ width, height }) => width < 576 || height < 380`
thumbnails
ThumbnailSrc
undefined
translations
any
undefined
menuGroup
string
undefined
noAudioGain
boolean
undefined
audioGains
object
undefined
noModal
boolean
undefined
noScrubGesture
boolean
undefined
sliderChaptersMinWidth
number
undefined
disableTimeSlider
boolean
undefined
noGestures
boolean
undefined
noKeyboardAnimations
boolean
undefined
playbackRates
object
undefined
seekStep
number
undefined
slots
DefaultAudioLayoutSlots
undefined
asChild
boolean
false
/* Example. */
.component[data-foo] {}
NameDescription
data-match
Whether this layout is being used.
data-sm
The small layout is active
data-lg
The large layout is active.
data-size
The active layout size (sm or lg).
HTMLAttributes

The video layout is our production-ready UI that's displayed when the media view type is set to 'video'. It includes support for picture-in-picture, fullscreen, slider chapters, slider previews, captions, audio/quality settings, live streams, and more out of the box.

import { DefaultVideoLayout } from "@vidstack/react/player/layouts/plyr";
<MediaPlayer src="video.mp4">
  <MediaProvider />
  <DefaultVideoLayout thumbnails="/thumbnails.vtt" icons={defaultLayoutIcons} />
</MediaPlayer>
PropTypeDefault
children
ReactNode
null
icons
DefaultLayoutIcons
undefined
colorScheme
string
undefined
download
FileDownloadInfo
undefined
showTooltipDelay
number
700
showMenuDelay
number
0
hideQualityBitrate
boolean
false
smallLayoutWhen
any
`({ width, height }) => width < 576 || height < 380`
thumbnails
ThumbnailSrc
undefined
translations
any
undefined
menuGroup
string
undefined
noAudioGain
boolean
undefined
audioGains
object
undefined
noModal
boolean
undefined
noScrubGesture
boolean
undefined
sliderChaptersMinWidth
number
undefined
disableTimeSlider
boolean
undefined
noGestures
boolean
undefined
noKeyboardAnimations
boolean
undefined
playbackRates
object
undefined
seekStep
number
undefined
slots
DefaultVideoLayoutSlots
undefined
asChild
boolean
false
/* Example. */
.component[data-foo] {}
NameDescription
data-match
Whether this layout is being used.
data-sm
The small layout is active
data-lg
The large layout is active.
data-size
The active layout size (sm or lg).