DEV Community

Elazizi Youssouf
Elazizi Youssouf

Posted on โ€ข Edited on

11 5

Introducing reactjs-popup ๐ŸŽ‰โ€Šโ€”โ€Š Modals, Tooltips, and Menusโ€Šโ€”โ€Š All in one

This article is about giving you a simple overview of what you can do with reactjs-popup and how to use it effectively.

Today, we are excited to announce reactjs-popup 1.0.

Reactjs-popup is a simple and very small (3 kb) react popup component, with multiple use cases. 
we created reactjs-popup to create a color picker for our project picsrush a new online image editor. After a while, We decided to make it available for everyone in GitHub and npm repository.

Why do you need to choose reactjs-popup over all other implementation?

  • Built with react fragment thatโ€™s mean no additional wrapper Divs in your code or in the trigger element. ๐Ÿ˜ฎ
  • Does not inject HTML outside your app root. ๐Ÿ“ฆ
  • Function as children pattern to take control over your popup anywhere in your code. ๐Ÿ’ช
  • Modal, Tooltip, Menu: All in one ๐Ÿ‹๏ธ
  • Full style customization ๐Ÿ‘Œ
  • Easy to use. ๐Ÿš€
  • All these clocks in at around 3 kB zipped. โšก๏ธ

Requires React >= 16.0

How can reactjs-popup help you in your next react project?

If you need to create a simple modal, tooltip or a nested menu this component is your best choice to start with. but first, let get started with the component.

All in one demo: Modal Tooltip and Menu

alt text

Getting Started 

This package is available in npm repository as reactjs-popup. It will work correctly with all popular bundlers.



npm install reactjs-popup --save
#using yarn
yarn add reactjs-popup -S


Enter fullscreen mode Exit fullscreen mode

Now you can import the component and start using it :



import React from "react";
import Popup from "reactjs-popup";

export default () => (
  <Popup trigger={<button> Trigger</button>} position="right center">
    <div>Popup content here !!</div>
  </Popup>
);


Enter fullscreen mode Exit fullscreen mode

You can also use it with function as children pattern.



import React from "react";
import Popup from "reactjs-popup";

export default () => (
  <Popup trigger={<button>Trigger</button>} position="top left">
    {close => (
      <div>
        Content here
        <a className="close" onClick={close}>
          &times;
        </a>
      </div>
    )}
  </Popup>
);


Enter fullscreen mode Exit fullscreen mode

Documentation and Examples : Reatjs popup home page

It your turn now to try it !!!

Thanks for reading! If you think other people should read this post and use this component, tweet and share the post and start the component repo.

GitHub logo yjose / reactjs-popup

React Popup Component - Modals,Tooltips and Menusโ€Šโ€”โ€Š All in one

Reactjs-popup

Build Status npm bundle size version downloads

MIT License All Contributors PRs Welcome Code of Conduct

Watch on GitHub Star on GitHub Tweet

Reactjs-popup is a simple react popup component that helps you create simple and complex Modals, tooltips, and Menus for your next React App.

You should consider using reactjs-popup for those couple of reasons :

  • โœ… Modal, Tooltip, Menu : All in one library ๐Ÿ‹๏ธ
  • โœ… Very tiny library (3kb) โšก๏ธ
  • โœ… Fully accessible
  • โœ… Function as children pattern to take control over your popup anywhere in your code ๐Ÿ’ช
  • โœ… Easy to use ๐Ÿš€
  • โœ… TypeScript Support ๐Ÿ‘Œ
  • โœ… IE Support. ๐Ÿš€
  • โœ… Full style customization ๐Ÿ‘Œ (js, CSS, styled-components)
  • โœ… Support for controlled Modals & Tooltips
  • โœ… Default & Custom Animations

Demo

This is a simple Demo to demonstrate how you can create Modals, Tooltips, Menus using reactjs-popup.

Live Demo

 reactjs popup demo


Sponsored by

frigade-sponsor

React-JS Popup is proud to be sponsored by Frigade, a developer tool for building better product onboardingโ€ฆ

What do you think, any ideas ๐Ÿ‘Œ?

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (5)

Collapse
 
rifaimartin profile image
Rifai Martin โ€ข

do you have number ?

Collapse
 
elaziziyoussouf profile image
Elazizi Youssouf โ€ข

number ??

Collapse
 
lukaszkuczynski profile image
lukaszkuczynski โ€ข

What do you mean?

Collapse
 
rifaimartin profile image
Rifai Martin โ€ข

no ... I mean, I want to ask if you have whatsApp number ..

do you have a particular community? I want to join and contribute

Collapse
 
razaakmal1 profile image
Raza Akmal โ€ข

if I have 5 menus in the popup and I want to disable 1 for user and another 1 for admin how can i do that?
if I dont show it instead of disabling it its UI look awkward

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay