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

@trbl/react-modal

v1.0.4

Published

America's next top modal.

Downloads

34

Readme

NPM Bundle Size Supported by TRBL

React Modal

A highly configurable, a11y-enabled library for creating dialogs, drawers, popups, popovers, mega-menus, light-boxes, etc, etc, etc. Modals...with fancy names. This library is agnostic in both structure and style. You decide what it does, how it works, how it looks...and ultimately what its called.

Highlights

  • Modular

    Get creative with your setup. Create a modal from anywhere with Modal or asModal. Interact with a modal from anywhere with useModal or withModal — or quickly control them with ModalToggler. Integrate into existing apps, retrofit existing components, and have fun.

  • Accessible

    Shipped fully accessible. ModalProvider, asModal, and ModalToggler strictly follow the WAI-ARIA guidelines on modal dialogs. You can also customize anything.

  • Contextual

    Leave your content put. Stop lifting state and drilling props, or throwing into Redux. Render ModalContainer anywhere in your app as a descendent of the ModalProvider to have your modal portal into. Also helpful in dealing with CSS stacking contexts.

  • Router Ready

    Control any modal with the URL. Share direct links, open on load, or navigate with the back button. Opt-in to use the history API. Using Next.js, Gatsby, or some other framework? Easily use those routers instead.

  • Faceless UI

    Applies no visual style, but encourages you to do so. Target any element and any state without additional legwork. BEM classes come shipped. Transition classes too, using react-transition-group. Build literally any modal experience, and start challenging your designers for a change.

  • Agnostic DOM

    Take complete control over the DOM. Things like custom markup, accessibility, or additional event handling. Everything beyond core functionality is extendable.

Quick Start

Installation

$ npm i @trbl/react-modal
$ # or
$ yarn add @trbl/react-modal

Composition

  import React from 'react';
  import {
    Modal,
    ModalContainer,
    ModalProvider,
    ModalToggler
  } from '@trbl/react-modal';

  const App = () => (
    <ModalProvider>
      <Modal slug="modal1">
        ...
      </Modal>
      <ModalToggler slug="modal1">
        ...
      </ModalToggler>
      <ModalContainer />
    <ModalProvider>
  );

  export default App;

For working examples, see the demo app.

Demo

$ git clone [email protected]:trouble/react-modal.git
$ yarn
$ yarn dev
$ open http://localhost:3000

API

Contribution

Help us, or let us help you help us.

License

MIT Copyright (c) TRBL, LLC