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-arise

v0.0.11

Published

Minimal sized popup/modal library built on React

Downloads

16

Readme

Arise

A small library for showing modals and popups, written in React. Compatible with preact and preact-compat. Total download size with gzipping sits just over 1KB. It is intended to be used with a module bundler like webpack.

Package Status

This is in beta stage right now. As soon as I get the tests up and going I'll promote it to stable, and I'll put the version at 1.0.

Installation

NPM: npm install react-arise

Yarn (suggested): yarn add react-arise

Usage

You can set the HTML directly or you can set a child element. It is highly suggested to only set one.

Example Component (ES6):

import React, Component from 'react';
import Arise from 'react-arise';

class ExampleComponent extends Component {

  render() {
    return <Arise />; // More specific example code below
  }
}

HTML:

<Arise show={ true } html="<p>Hey, I'm a modal!</p>" modal={true} onClose={ closeFunc }/>

Child:

  <input ref="inputElement">
  <Arise show={ false } anchorElement={ this.refs.inputElement } onClose={ closeFunc }>
    <p>Put your text in here, bloke</p>
  </Arise>

Attributes

  • show (boolean): Change whether the popup/modal is shown.
  • html (string): Sets the innerHTML of the component's inner container. Use this instead of passing children if you like.
  • modal (boolean): Modal mode. Sets up an overlay and the content on top of that. See the notes section at the end for considerations.
  • modalClasses (object): Classes for modal mode (not popup). Can contain up to two keys: container and content, both with string values of what you want the class names to be.
  • popupClass (string): Class for container in popup mode (not modal)
  • closeOnClick (boolean): In modal mode, decide whether clicking on the overlay closes the modal. Defaults to true.
  • anchorElement (element): In popup mode, the element that the popup is tied to. At the moment it is only shown below, but that is expected to change in the future.
  • popupPadding (string): In popup mode, the CSS value for the amount of space given between the anchorElement and the container. It has a default of 5px.
  • onClose (function): Function that is called when closing. Be sure to change the state for whatever you're using to control the show property.

Notes

The popup/modal containers in the component do not break out of normal component embedding. That means if you embed the component in another that is relatively positioned it may not behave the way you expect. That is, unless you expect the modal to only cover the component that is relatively positioned. If you need a universal modal/popup that appears above everything, you can try using Arise.universal(props). You can pass all the props above along as an object. There may be kinks in using this function as a component, but if there are I plan to make it work.

License

It's MIT, which means you can use it for whatever you want. The only stipulation is that you give proper credit that the end user can see in the delivered asset files which include the code.