ReferenceButtons
media-fullscreen-button
Accessible fullscreen toggle button with keyboard support and state reflection
Import
Anatomy
Behavior
Toggles fullscreen mode. The button derives two state hooks from availability:
disabled(trueuntil fullscreen is available, or when thedisabledprop is set) — setsaria-disabled="true"anddata-disabled. A prop-disabled, available button stays focusable but does not activate.hidden(truewhile fullscreen is"unavailable"or"unsupported") — applies the native HTMLhiddenattribute on the custom element.
Styling
You can style the button based on fullscreen state:
The button remains hidden until fullscreen is available.
The element receives the native hidden attribute. No extra CSS is required.
Accessibility
Renders a <button> with an automatic aria-label: “Enter fullscreen” or “Exit fullscreen”. Override with the label prop. Keyboard activation: Enter / Space.