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

modal-reactjs-tailwindcss

v1.0.2

Published

A responsive modal component for React with keyboard interaction support and customizable icons, designed to improve accessibility.

Downloads

23

Readme

modal-reactjs-tailwindcss

The modal-reactjs-tailwindcss component provides a flexible and accessible modal window, ideal for displaying messages or confirming actions. It includes customizable icons, manages focus for better accessibility, and allows you to close the modal by clicking outside it. Perfect for use cases like confirming a successful action or presenting important information.

Github

github.com/Vanda89/modal-reactjs-tailwindcss

Installation

To use this component in your project, run the following command:

npm i modal-reactjs-tailwindcss

Usage

import React from 'react'
import Modal from '@your-org/modal'
import { FaInfoIcon } from 'react-icons/fa'

const App = () => {
  const [isOpen, setIsOpen] = useState(false)

  const openModal = () => {
    setIsOpen(true)
  }

  const closeModal = () => {
    setIsOpen(false)
  }

  const customActions = [
    {
      label: 'Custom Action 1',
      bgColor: 'bg-blue-500',
      borderColor: 'border-blue-600',
      hoverBgColor: 'hover:bg-blue-700',
      onClick: () => console.log('Custom Action 1 clicked'),
    },
  ]

  return (
    <div>
      <button onClick={openModal}>Open Modal</button>
      <button onClick={closeModal}>Close Modal</button>

      <Modal
        isOpen={isOpen}
        isHidden={true}
        onClose={closeModal}
        actions={customActions}
        infoIcon={FaInfoIcon}
        infoContainerColor="bg-green-100"
      />
    </div>
  )
}

export default App

Tailwind CSS

This project utilizes Tailwind CSS for styling. Tailwind CSS is a utility-first CSS framework for rapidly building custom designs. If you are not familiar with Tailwind CSS, you can learn more about it on the Tailwind CSS website.

To customize the styles of the modal component, you can leverage the utility classes provided by Tailwind CSS. Tailwind CSS allows you to quickly style your components by applying pre-defined classes directly in your HTML or JSX.

Feel free to explore the Tailwind CSS documentation to discover the full range of utility classes available for styling your components.

Props

isOpen (Boolean, required)

  • Description: Controls the visibility of the modal.
  • Default: false

isHidden (Boolean, optional)

  • Description: Determines if the modal is hidden.
  • Default: false

onClose (Function, required)

  • Description: Function called when the user closes the modal.

closeIcon (ReactNode, optional)

  • Description: The close icon of the modal.

infoIcon (ReactNode, optional)

  • Description: The information icon to display in the modal.

infoIconColor (String, optional)

  • Description: The color of the information icon.

infoIconSize (String, optional)

  • Description: The size of the information icon.

infoContainerColor (String, optional)

  • Description: The color of the information container in the modal.

actions (Array, optional)

  • Description: An array of action objects that define the actions to be displayed in the modal.
  • Default: []

License

This project is licensed under the MIT License. See the LICENSE file for more information.