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

repopup

v1.2.2

Published

Easy to use as well as reusable and customizable react modals

Downloads

4

Readme

The aim of REPopup is to provide an all-in-one UI components related to modal and popup windows for creating apps in react. There are many great ui components made by developers all around open source. REPopup makes using modals and popups very easy by giving you a ready made as well as easily customizable kit with consistent api and look and feel.

Features

  • React modal components for easy and fast web development.
  • Flexible modal positioning.
  • Styled components and easy to customize.
  • Works in major browsers without polyfills.
  • Ready made and well designed InputDialog component.
  • Alert component with five different variants.
  • Supports TypeScript.
  • And much more !

Resources

Installation

Install via NPM

npm install repopup

Install via Yarn

yarn add repopup

Peer dependencies

Install styled-components

Install via NPM

npm install styled-components

Install via Yarn

yarn add styled-components

If you have any issues installing styled-components, check out their installation guide here.

Getting Started

For complete usage, visit the docs.

The below example demonstrates very basic and full usages of Modal component respectively.

  • Initialize a open state with boolean value false and assign it as 'open' prop. Now it will control wheather Modal should be open or closed.
  • For onRequestClose prop, pass the Function which will set the open state to false

Install the REPopup and styled-components package from the NPM

npm install repopup styled-components

Import the RepopupProvider and wrap your App component

import { RepopupProvider } from 'repopup';
ReactDOM.render(
		<RepopupProvider theme="dark">
			<App />
		</RepopupProvider>,
	document.getElementById('root')

Import the component and use it in your project

Basic Usage

import React, { useState } from 'react';
import { Modal } from 'repopup';

function App() {
  const [open,setOpen] = useState(false);

return (
  <div>
	<button onClick={() => setOpen(true)}>Open</button>
	<Modal 
      onRequestClose={() => setOpen(false)} 
      open={open} 
      title={`Hello From REPopup 🎉🎉🎉 `} 
     />
</div>
);
}

export default App;
Result

Full Usage

import React, { useState } from 'react';
import { Modal } from 'repopup';

function App() {
  const [open,setOpen] = useState(false);

  return (
   <div>
	 <button onClick={() => setOpen(true)}>Open</button>
	      <Modal
				onRequestClose={() => setOpen(false)}
				open={open}
				title={`Are you sure?`}
				subtitle={`You won't be able to revert this!`}
				icon="warning"
				closeOnBackdropClick={true}
				showConfirmButton
				confirmButtonText={`Yes,delete it!`}
				onConfirm={() => console.log('Deleted successfully!!')}
				showDenyButton
				denyButtonText="Cancel"
				onDeny={() => setOpen(false)}
			/>
		</div>
  );
}

export default App;
Result

Available Props

| Props | Type | Description | Default | | :-------------: | :---------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :----------: | | background | string | Popup window background (CSS background property). | '#ffffff' | | cancelButtonText | string | Use this to change the text on the "Cancel"-button. | Cancel | | childrenAfterDefaultContent | ReactNode | null | Use this to place children after default content of the popup |null | childrenBeforeDefaultContent | ReactNode | null | Use this to place children before default content of the popup |null | closeOnBackdropClick | boolean | Wheather or not to close the popup on clicking the backdrop | true | | color | string | Color for title and content | '#000000' | | confirmButtonText | string | Use this to change the text on the "Confirm"-button. | 'Confirm' | | customClass | IModalCustomClassType; | A custom CSS class for the popup | {} | | denyButtonText | string | Use this to change the text on the "Deny"-button. | 'Deny' | | icon | success| error| info| warning| question| null | varinat of a icon to be shown | null | | onCancel | React.MouseEventHandler<HTMLButtonElement> | undefined | Use this as a click handler for the "Cancel"-button. | () => {} | | onConfirm | React.MouseEventHandler<HTMLButtonElement> | undefined | Use this as a click handler for the "Confirm"-button | () => {} | | onDeny | React.MouseEventHandler<HTMLButtonElement> | undefined | Use this as a click handler for the "Deny"-button. | () => {} | | onRequestClose | Function | Function that will be run when the modal is requested to be closed | required | | onSuccess | React.MouseEventHandler<HTMLButtonElement> | undefined | Use this as a click handler for the "Success"-button. | () => {} | | open | boolean | Boolean describing if the modal should be shown or not. | required | | placement | 'top'| 'center' | 'bottom'| 'center-start'| 'bottom-start'| 'top-start'| 'top-end'| 'bottom-end'| 'center-end' | Use this to change Popup window position | center | | showCancelButton | boolean | If set to true, a "Cancel"-button will be shown. | false | | showConfirmButton | boolean | If set to true, a "Confirm"-button will be shown. | false | | showDenyButton | boolean | If set to true, a "Deny"-button will be shown. | false | | showSuccessButton | boolean | If set to true, a "Success"-button will be shown. | false | | subtitle | string | Used for a description for the popup. | | | successButtonText | string | Use this to change the text on the "Success"-button. | Ok | | title | string | Used for the title of the popup | |

Support

License

REPopup is licensed under the MIT License.