ReferenceButtons
FullscreenButton
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") — the component returnsnull.
Styling
You can style the button based on fullscreen state:
React renders a <button> element. Add a className to style it:
The button remains hidden until fullscreen is available.
The component returns null. 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.