Skip to content

andrelmlins/preact-fullscreen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preact Fullscreen

npm versionLicense: MITBuild Status

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-fullscreen";

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

Prop Type Description
onChange func Call in change
onError func Call in error

Children Function Properties

Prop Type Description
ref object Ref dom element
onToggle func Call for fullscreen toggle
onExit func Call for fullscreen exit
onRequest func Call for fullscreen enter

Browsers Support

You can see the list of supported browsers here

Browsers support

License

Preact Fullscreen is open source software licensed as MIT.