Socket
Socket
Sign inDemoInstall

modal_by_jsw

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    modal_by_jsw

modal form to appear whent it's called


Version published
Weekly downloads
7
decreased by-94.26%
Maintainers
1
Install size
4.72 MB
Created
Weekly downloads
 

Readme

Source

modal_by_jsw

This React library offers a customizable modal component designed for effortless integration across a variety of React applications. It allows for customization of text and modal behavior through props, making it highly adaptable to any user interface.

Features

  • Customizable Content: Supports passing custom text and additional content.
  • Ease of Integration: Simplifies integration with any React application.
  • No External Dependencies: Operates independently without the need for external dependencies.
  • Accessibility Features: Includes keyboard navigation and focus management to enhance accessibility.

Installation

You can install the modal component using npm or Yarn:

npm install modal_by_jsw
# or using Yarn
yarn add modal_by_jsw

Prerequisites

This library requires Node.js version 12 or higher.

Usage

Here is a simple example to help you get started with the Modal in your React application:

import React, { useState } from 'react';
import Modal from 'modal_by_jsw';
import PropTypes from 'prop-types';

const BurgerMenu = () => {
  const [modalIsOpen, setModalIsOpen] = useState(false);
  const [menuItem, setMenuItem] = useState('');

  // Function to open modal with specific menu item description
  const handleMenuItemClick = (item) => {
    setMenuItem(item);
    setModalIsOpen(true);
  };

  return (
    <div>
      <button onClick={() => handleMenuItemClick('Classic Burger')}>Classic Burger</button>
      <button onClick={() => handleMenuItemClick('Cheese Burger')}>Cheese Burger</button>
      <button onClick={() => handleMenuItemClick('Veggie Burger')}>Veggie Burger</button>
      {modalIsOpen && (
        <Modal setModalIsOpen={setModalIsOpen} text={`You selected: ${menuItem}. Enjoy your meal!`} />
      )}
    </div>
  );
};

export default BurgerMenu;

Keywords

FAQs

Last updated on 22 Apr 2024

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc