FrameworkStyle

FullscreenButton

Accessible fullscreen toggle button with keyboard support and state reflection

Anatomy

<FullscreenButton />

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

import { createPlayer, FullscreenButton } from '@videojs/react';
import { Video, videoFeatures } from '@videojs/react/video';

import './BasicUsage.css';

const Player = createPlayer({ features: videoFeatures });

export default function BasicUsage() {
  return (
    <Player.Provider>
      <Player.Container className="react-fullscreen-button-basic">
        <Video
          src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
          autoPlay
          muted
          playsInline
          loop
        />
        <FullscreenButton
          className="react-fullscreen-button-basic__button"
          render={(props, state) => <button {...props}>{state.fullscreen ? 'Exit Fullscreen' : 'Fullscreen'}</button>}
        />
      </Player.Container>
    </Player.Provider>
  );
}

API Reference

Props

Prop Type Default
disabled boolean false
label string | function ''

State

State is accessible via the render, className, and style props.

Property Type
availability 'available' | 'unavailable' | 'unsupp...
fullscreen boolean

Data attributes

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