You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@solid-primitives/fullscreen

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/fullscreen

Primitive that wraps the fullscreen API.

1.3.3
latest
Source
npmnpm
Version published
Weekly downloads
410
-17.84%
Maintainers
3
Weekly downloads
 
Created
Source

Solid Primitives Fullscreen

@solid-primitives/fullscreen

size size stage

Creates a primitive wrapper around the Fullscreen API that can either be used as a directive or a primitive.

Installation

npm install @solid-primitives/fullscreen
# or
yarn add @solid-primitives/fullscreen

How to use it

createFullScreen

const MyComponent2: Component = () => {
  const [fs, setFs] = createSignal(false);
  let [ref, setRef] = createSignal<HTMLDivElement>();
  const active: Accessor<boolean> = createFullscreen(ref, fs);
  return (
    <div ref={setRef} onClick={() => setFs(fs => !fs)}>
      {!active() ? "click to fullscreen" : "click to exit fullscreen"}
    </div>
  );
};

This variant requires the ref to be a signal, otherwise the not-yet-filled ref will be captured in the closure of the primitive.

You can either put the options into the second argument accessor output (useful for the directive use case) or as a third argument.

Directive

const isActive: Accessor<boolean> = createFullscreen(
  ref: HTMLElement | undefined,
  active?: Accessor<FullscreenOptions | boolean>,
  options?: FullscreenOptions
);

// can be used as a directive

const MyComponent: Component = () => {
  const [fs, setFs] = createSignal(false);
  return (<div use:createFullScreen={fs} onClick={() => setFs(fs => !fs)}>
    {!fs() ? 'click to fullscreen' : 'click to exit fullscreen'}
  </div>);
}

Demo

TODO

Changelog

See CHANGELOG.md

Keywords

fullscreen

FAQs

Package last updated on 30 Jun 2025

Did you know?

Socket

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.

Install

Related posts