Skip to content
FrameworkStyle

media-fullscreen-button

Accessible fullscreen toggle button with keyboard support and state reflection

Anatomy

<media-fullscreen-button></media-fullscreen-button>

Behavior

Toggles fullscreen mode. Detects platform support through availability — when fullscreen is "unsupported", the toggle does nothing.

Styling

You can style the button based on fullscreen state:

/* In fullscreen */
media-fullscreen-button[data-fullscreen] {
  background: red;
}

Consider hiding the button when unsupported:

media-fullscreen-button[data-availability="unsupported"] {
  display: none;
}

Accessibility

Renders a <button> with an automatic aria-label: “Enter fullscreen” or “Exit fullscreen”. Override with the label prop. Keyboard activation: Enter / Space.

Examples

Basic Usage

Exit Fullscreen Fullscreen
<video-player class="video-player">
    <media-container>
        <video
            src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
            autoplay
            muted
            playsinline
            loop
        ></video>
        <media-fullscreen-button class="media-fullscreen-button">
            <span class="fullscreen">Exit Fullscreen</span>
            <span class="not-fullscreen">Fullscreen</span>
        </media-fullscreen-button>
    </media-container>
</video-player>

API Reference

Props

Prop Type Default Details
disabled boolean false
label 'play' | 'pause' | 'replay' | 'mute' | 'unmute' | 'seekForward' | 'seekBackward' | 'enterFullscreen' | 'exitFullscreen' | 'enableCaptions' | 'disableCaptions' | 'enterPictureInPicture' | 'exitPictureInPicture' | 'playingLive' | 'seekToLiveEdge' | 'liveBadge' | 'startCasting' | 'stopCasting' | 'connectingCast' | 'seek' | 'volume' | 'timeCurrent' | 'timeDuration' | 'timeRemaining' | 'timeRemainingPhrase' | 'playbackRateAria' | 'timeSliderValueTextRange' | 'volumeSliderValueTextMuted' | 'indicatorMuted' | 'indicatorVolume' | 'indicatorVolumeWithValue' | 'indicatorCaptionsOn' | 'indicatorCaptionsOff' | 'indicatorPaused' | 'indicatorPlaying' | 'indicatorFullscreen' | 'indicatorExitFullscreen' | 'indicatorPictureInPicture' | 'indicatorExitPictureInPicture' | 'mediaErrorAborted' | 'mediaErrorNetwork' | 'mediaErrorDecode' | 'mediaErrorSrcNotSupported' | 'mediaErrorEncrypted' | 'mediaErrorCustom' | 'errorDialogTitle' | 'errorDialogDismiss' | 'mediaErrorFallback' | string & object | function ''

State

State is reflected as data attributes for CSS styling.

Property Type Details
availability 'available' | 'unavailable' | 'unsupp...
fullscreen boolean
label 'play' | 'pause' | 'replay' | 'mute' ...

Data attributes

Attribute Type Details
data-fullscreen
data-availability 'available' | 'unavailable' | 'unsupp...