ReferenceButtons
media-pip-button
Accessible picture-in-picture toggle button with keyboard support and state reflection
Import
Anatomy
Behavior
Toggles picture-in-picture (PiP) mode. The button derives two state hooks from availability:
disabled(trueuntil PiP 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 PiP is"unavailable"or"unsupported") — applies the native HTMLhiddenattribute on the custom element.
Styling
You can style the button based on PiP state:
The button remains hidden until picture-in-picture is available.
The element receives the native hidden attribute. No extra CSS is required.
Accessibility
Renders a <button> with an automatic aria-label: “Enter PiP” or “Exit PiP”. Override with the label prop. Keyboard activation: Enter / Space.