0.1.2 • Published 4 years ago

preact-fullscreen v0.1.2

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

Preact FullScreen

npm version License: MIT Build Status Dependencies

Component that performs fullscreen in DOM Elements

Installation

npm i preact-fullscreen
// OR
yarn add preact-fullscreen

Demo

Local demo:

git clone https://github.com/andrelmlins/preact-fullscreen.git
cd preact-fullscreen
yarn install && yarn start

Examples

import { h, render } from "preact";
import PreactFullscreeen from "preact-ullscreen";

const App = () => (
  <PreactFullscreeen>
    {({ ref, onRequest, onExit }) => (
      <div
        ref={ref}
        style={{ backgroundColor: "red", width: 120, height: 120 }}
      >
        <button onClick={() => onRequest()}>FullScreen</button>
        <button onClick={() => onExit()}>Screen</button>
      </div>
    )}
  </PreactFullscreeen>
);

render(<App />, document.body);

Properties

PropTypeDescription
onChangefuncCall in change
onErrorfuncCall in error

Children Function Properties

PropTypeDescription
refobjectRef dom element
onTogglefuncCall for fullscreen toggle
onExitfuncCall for fullscreen exit
onRequestfuncCall for fullscreen enter

NPM Statistics

Download stats for this NPM package

NPM

License

Preact FullScreen is open source software licensed as MIT.

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago