
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-styled-pip
Advanced tools
This is a simple utility package for document picture in picture with styled components
A React component library for creating Picture-in-Picture windows using the Document Picture-in-Picture API with styled-components support.

This feature may not work in some browsers. Browser compatibility can be checked at CanIUse.
This feature is only available in Secure Contexts (HTTPS or localhost).
npm install react-document-pip
import { useState } from "react";
import DocumentPip from "react-document-pip";
function App() {
const pipWindowRef = useRef<Window | null>(null);
const [isPipOpen, setIsPipOpen] = useState(false);
const togglePip = () => {
setIsPipOpen(!isPipOpen);
};
const handleClose = () => {
setIsPipOpen(false);
};
return (
<>
<DocumentPip
ref={pipWindowRef}
isPipOpen={isPipOpen}
size={{ width: 500, height: 400 }}
className="dark"
onClose={handleClose}
>
<MyComponent />
</DocumentPip>
<button onClick={togglePip}>Toggle PIP</button>
</>
);
}
| Type | Description |
|---|---|
Window | null | PIP window |
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The content to display in the PIP window |
isPipOpen | boolean | - | Controls whether the PIP window is open |
size | Partial<PIPWindowSize> | - | Size of the PIP window |
mode | 'clone' | 'transfer' | 'transfer-only' | 'transfer' | Content display modeclone: keep original + copytransfer: move to PIPtransfer-only: move to PIP without original |
copyAllStyles | boolean | true | Whether to copy all styles to PIP window |
disallowReturnToOpener | boolean | false | Whether to disallow returning to the opener window |
preferInitialWindowPlacement | boolean | false | Whether to prefer initial window placement |
className | string | '' | pip window documentElement classname |
onEnter | () => void | - | Callback function when the PIP window is successfully opened |
onClose | () => void | - | Callback function when the PIP window is closed |
interface PIPWindowSize {
width: number;
height: number;
}
type PIPMode = "clone" | "transfer" | "transfer-only";
interface DocumentPIPProps {
children: React.ReactNode;
isPipOpen: boolean;
size?: Partial<PIPWindowSize>;
mode?: PIPMode;
copyAllStyles?: boolean;
disallowReturnToOpener?: boolean;
preferInitialWindowPlacement?: boolean;
className?: string;
onEnter?: (e: DocumentPictureInPictureEvent) => void;
onClose: () => void;
}
This library uses the Document Picture-in-Picture API, which is currently supported in:
MIT
FAQs
This is a simple utility package for document picture in picture with styled components
We found that react-styled-pip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.