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

bd-react-simple-modal

v0.1.1

Published

`bd-react-simple-modal` is a simple and customizable modal component for React, designed to be lightweight and easy to integrate into any project. Includes essential features like backdrop opacity, adjustable size, and accessibility support.

Downloads

7

Readme

bd-react-simple-modal

bd-react-simple-modal is a simple and customizable modal component for React, designed to be lightweight and easy to integrate into any project. Includes essential features like backdrop opacity, adjustable size, and accessibility support.

NPM

HTML CSS React TypeScript npm

Install

You can install the package via npm:

npm install bd-react-simple-modal

Usage

Here is an example of how to use the Modal component:

import React, { useState } from 'react';
import { Modal } from 'bd-react-simple-modal';

const App = () => {
  const [isModalOpen, setIsModalOpen] = useState(false);

  const handleOpenModal = () => setIsModalOpen(true);
  const handleCloseModal = () => setIsModalOpen(false);

  return (
    <div>
      <button onClick={handleOpenModal}>Open Modal</button>
      <Modal
        isOpen={isModalOpen}
        onClose={handleCloseModal}
        title="Example Modal"
        size="medium"
        backdropOpacity={0.5}
      >
        <p>This is the content of the modal.</p>
      </Modal>
    </div>
  );
};

export default App;

Props

  • isOpen (boolean): Controls whether the modal is visible or not.
  • onClose (() => void): Function to call when the modal should be closed.
  • title (string): Optional title to display at the top of the modal.
  • size ('small' | 'medium' | 'large'): Size of the modal. Default is 'medium'.
  • backdropOpacity (number): Opacity of the backdrop. Default is 0.5.
  • children (React.ReactNode): The content to display inside the modal.
  • showCloseButton (boolean): Whether to show a close button. Default is true.
  • onBackdropClick (() => void): Function to call when the backdrop is clicked.
  • aria-labelledby (string): ID of the element that labels the modal.
  • aria-describedby (string): ID of the element that describes the modal.

CSS Classes

The Modal component uses the following CSS classes for styling. You can override these classes in your own CSS to customize the appearance of the modal.

  • .modal-backdrop: Styles the dark background behind the modal.
  • .modal: The main container for the modal content.
  • .modal-header: The header section of the modal.
  • .modal-body: The body section where the main content is displayed.
  • .modal-footer: Optional footer section for actions like buttons.
  • .modal-small, .modal-medium, .modal-large: Different size options for the modal.
  • .modal-close-button: Styles the close button inside the modal.
  • .modal-buttons: Styles for button groups in the modal.

For more advanced customization, you can modify these classes or add new ones in your CSS.

Built with TSDX

This project was bootstrapped with TSDX.

License

MIT © bdelanls