1.1.0 • Published 6 months ago

react-pip v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 months ago

react-pip (Picture in Picture)

Use Document Picture-in-Picture API to create an always-on-top window.

Demos:

Usage

import {PIPPortal} from 'react-pip'

function Demo() {
  const [isOpen, setIsOpen] = useState(false)

  return (
    <>
      <button onClick={() => setIsOpen(!isOpen)}>Toggle PIP Window</button>
      {isOpen && (
        <PIPPortal width={400} height={200} onClose={() => setIsOpen(false)}>
          Content
        </PIPPortal>
      )}
    </>
  )
}

Types

export type PIPPortalProps = {
  width?: number
  height?: number
  children: React.ReactNode
  onClose?: () => void
}

Development

React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

1.1.0

6 months ago

1.0.0

6 months ago

0.0.0

5 years ago