Socket
Book a DemoInstallSign in
Socket

react-component-hw

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

react-component-hw

A simple and customizable modal window component for React applications.

1.0.6
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

⚠️ Package Deprecation

This package is deprecated and will no longer be maintained.

Please use react-modal-component-hw instead.

status Static Badge Static Badge Static Badge Static Badge

A simple and customizable modal window component for React applications.

Table of Contents

Installation

To install the modal component in your React project, you can use npm or yarn:

npm install react-component-hw

or

yarn add react-component-hw

Usage

To use the Modal component in your React application, import it into your file and incorporate it into your JSX or JS code.

import React, { useState } from 'react';
import Modal from 'react-component-hw';

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

    const toggleModal = () => {
        setIsOpen(!isOpen);
    };

    return (
        <div>
            <button onClick={toggleModal}>Open Modal</button>
            <Modal isOpen={isOpen} onClose={toggleModal}>
                <h2>Modal Title</h2>
                <p>This is the content of the modal.</p>
                <button onClick={toggleModal}>Close Modal</button>
            </Modal>
        </div>
    );
};

export default App;

Props

The Modal component accepts the following props:

  • isOpen (required): A boolean indicating whether the modal should be displayed or not.
  • onClose (required): A callback function called when the modal should be closed.
  • children: The elements to be displayed inside the modal.

Example

You can find an example of using the Modal component in the src/App.jsx file. To run the example, follow these steps:

  • Clone the repository.
  • Navigate to the project directory in the terminal.
  • Run npm install or yarn install to install the dependencies.
  • Run npm start or yarn start to start the application.

Styles

The Modal component does not provide default styles for the modal window itself. You are free to add your own CSS styles to customize the appearance of the modal as needed. However, the component may include default styles for the overlay (the dark background that appears behind the modal), the window, and the close button. If you wish to customize these styles, you can use the following CSS classes:

  • modal-overlay: Class for the modal overlay.
  • modal-container: Class for the modal window itself.
  • modal-btn-close: Class for the close button of the modal.
  • modal-btn-close-icon: Class for the close button icon of the modal.
  • modal-btn-close-icon:hover: Pseudo-class when hovering over the close button icon of the modal.

License

This project is licensed under the MIT.

Keywords

React

FAQs

Package last updated on 27 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.