npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-window-renderer

v1.2.5

Published

Introducing a new feature in React that allows developers to render part of a component in a new browser tab or window. This functionality is particularly useful for displaying large content across two related windows, enhancing the user experience when w

Downloads

49

Readme

react-window-renderer

Introducing a new feature in React that allows developers to render part of a component in a new browser tab or window. This functionality is particularly useful for displaying large content across two related windows, enhancing the user experience when working with dual screens in extended mode. Ideal for scenarios where users need to view or interact with content simultaneously across multiple screens.

Demo

Demo preview

[!CAUTION] This package is under development, you might face some buggy behaver

Support

support me to keep this work up by buying me a coffee

Installation

npm i react-window-renderer

Examples

example with button open/close

import { RenderInWindow, useRenderInWindow } from "react-window-renderer";

const BasicUsageExample = () => {
  const { open, setOpen, _window } = useRenderInWindow();

  return (
    <>
      <h1>React Window Renderer Basic Example</h1>
      <RenderInWindow
        open={open}
        setOpen={setOpen}
        returnWindow={(w) => (_window.current = w)}
      >
        <div>Render this content in new window</div>
      </RenderInWindow>
      <button onClick={() => setOpen(!open)}>
        {open ? "Close Window" : "Open Window"}
      </button>
    </>
  );
};

export default BasicUsageExample;

example with enable open/close icons

import { RenderInWindow, useRenderInWindow } from "react-window-renderer";

const BasicNoCssUsageExample = () => {
  const { open, setOpen, _window } = useRenderInWindow();

  return (
    <>
      <h1>React Window Renderer Basic Example</h1>
      <RenderInWindow
        open={open}
        setOpen={setOpen}
        showCloseWindowIcon
        showOpenWindowIcon
        showChilderWhenClose
        returnWindow={(w) => (_window.current = w)}
        extraHeadHTMLTags={[<style ref="" />]}
      >
        <div>Render this content in new window</div>
      </RenderInWindow>
    </>
  );
};

export default BasicNoCssUsageExample;

Props Table for RenderInWindow Component

| Prop | Default Value | Required/Optional | Explanation | | ----------------------- | ------------------------------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | open | - | Required | Controls whether the window is currently open or closed. A boolean value indicating the state. | | setOpen | - | Required | A React state setter function used to toggle the window's open state. This function updates the open prop. | | children | - | Required | The JSX Element(s) that will be rendered inside the new window. Must be provided for the component to function. | | returnWindow | - | Required | A callback function that receives the newly opened window object, allowing further manipulation if needed. | | showChilderWhenClose | false | Optional | If true, the children will be showen when the window is closed, ensuring they are displayed in the original component. | | showOpenWindowIcon | false | Optional | If true, an icon will be displayed to indicate the option to open the window. Useful for improving user experience. | | openWindowIconConfig | see IIconConfig | Optional | Configuration for the open window icon, allowing you to set width and height. Defaults to 30px by 30px. | | showCloseWindowIcon | false | Optional | If true, an icon will be shown to allow the user to close the window. Enhances usability by providing a visual cue. | | closeWindowIconConfig | see IIconConfig | Optional | Configuration for the close window icon, allowing you to set width and height. Defaults to 30px by 30px. | | windowConfig | see IWindowConfig | Optional | Configuration object for the window's properties such as width, height, position, and other window features (toolbar, menubar, etc.). | | extraHeadHTMLTags | - | Optional, Experimental | An array of JSX elements (e.g. <style> or <script>) that will be injected into the window's head section. Experimental and subject to change. |


Props Table for IWindowConfig Object

| Prop | Default Value | Required/Optional | Explanation | | ------------ | --------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------- | | url | undefined | Optional | URL of the window. | | left | 0 or screen.width | Optional | The distance from the left of the screen to the window. Defaults to the full screen width or 0 if popup is true. | | top | 0 | Optional | The distance from the top of the screen to the window. Defaults to 0. | | height | screen.height | Optional | The height of the window. Defaults to the full screen height. | | width | screen.width | Optional | The width of the window. Defaults to the full screen width. | | menubar | "no" | Optional | Enables or disables the menubar in the window. | | toolbar | "no" | Optional | Enables or disables the toolbar in the window. | | location | "no" | Optional | Enables or disables the location bar in the window. | | status | "no" | Optional | Enables or disables the status bar in the window. | | resizable | "yes" | Optional | Enables or disables the window resizing feature. | | scrollbars | "no" | Optional | Enables or disables scrollbars in the window. | | popup | true | Optional | Determines if the window should be rendered as a popup. If false, it will render in a new tab. |


Props Table for IIconConfig Object

| Prop | Default Value | Required/Optional | Explanation | | -------- | ------------- | ----------------- | --------------------------------- | | width | 30 | Optional | The width of the icon in pixels. | | height | 30 | Optional | The height of the icon in pixels. |

License

MIT

Author

Mohammed Ridha. M. M.