Socket
Socket
Sign inDemoInstall

react-animated-popup

Package Overview
Dependencies
3
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-animated-popup

A npm react module for making react elements animate in and out like a popup with outside touches dismissing it.


Version published
Weekly downloads
62
decreased by-4.62%
Maintainers
1
Install size
5.13 kB
Created
Weekly downloads
 

Readme

Source

React Animated Popup

React animated popup is a lightweight zero-dependency module to make elements become popups and animate in and out.

Demo

Try the interactive demo here.

Installation

npm install --save react-animated-popup

Usage

Import Popup and use the component like the snippet. Note that you will need to update your visibility state on the onClose event.

The Popup element can be placed anywhere in your DOM! Just make sure it is not inside a position: absolute/relative element.

The children can be anything you want! Create a popup for your purpose.

If you want more usage help check out the demo repository code here.

import Popup from 'react-animated-popup'

// ...

const [visible, setVisible] = useState(false)

return (
  <Popup visible={visible} onClose={() => setVisible(false)}>
    <p>I am a popup!</p>
  </Popup>
)

Props

children

  • optional
  • type: ReactNode

Children to make up the popup.

visible

  • required
  • type: boolean

The prompt state, make true to make the prompt appear.

onClose

  • required
  • type: CloseHandler

Function called when closing. It is recommended to update your visible state to false on this callback.

animationDuration

  • optional
  • type: number
  • default: 100

The duration of the animations in ms.

style

  • optional
  • type: CSSProperties

Override styling to the popup div. Per default, it has a white background, rounded corners, and shadow. Everything can be overridden and it can be designed however you like!

className

Classname to add to the popup div.

Keywords

FAQs

Last updated on 28 Sep 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc