Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.
/ popify Public archive

A small library for building popups/notifications in React. Built with simplicity and accessibility in mind.

License

Notifications You must be signed in to change notification settings

jozefhruska/popify

Repository files navigation

Popify 🍾

A small library for building popups/notifications in React. Built with simplicity and accessibility in mind.

stable license

Examples 😲

Edit popify-basic

Installation 🛠

npm install popify

Usage ❓

import React from 'react';

import { Popup } from 'popify';

const App: React.FC = () => {
  return (
    <>
      <main>Hello!</main>

      <Popup
        onClose={() => console.log('onClose')}
        primaryButton={{
          children: 'Thanks!',
          onClick: () => console.log('onClick - Primary'),
        }}
        secondaryButton={{
          children: 'Yeah sure...',
          onClick: () => console.log('onClick - Secondary'),
        }}
      >
        Welcome on our page! You're the 1000th visitor, here's your free iPad!
      </Popup>
    </>
  );
};

export default App;

Props 👀

Name Type Default value Description
onClose (() => any) | (() => Promise<any>) undefined Function to be called after popup is closed.
primaryButton ButtonHTMLAttributes<HTMLButtonElement> undefined Object containing properties passed to primary button.
secondaryButton ButtonHTMLAttributes<HTMLButtonElement> undefined Object containing properties passed to secondary button.
showCloseIcon boolean true Shows and hides close button.
position 'left' | 'right' right Specifies the position of popup window.
styles FlattenSimpleInterpolation | FlattenInterpolation<any> undefined Pass styled-component's css result to add custom styles.

About

A small library for building popups/notifications in React. Built with simplicity and accessibility in mind.

Resources

License

Stars

Watchers

Forks

Packages

No packages published