0.1.3 • Published 1 year ago

modal-react-vite-ts v0.1.3

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

📦 modal-react-vite-ts

A modal component for React and TypeScript applications.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js: v14.0.0 or higher

  • Text Editor: It is recommended to use Visual Studio Code or another code editor of your choice.

🚀Installation

Via npm:

npm install modal-react-vite-ts 

Or via yarn:

yarn add modal-react-vite-ts

⚙️ Modal Props

The Modal component accepts the following props:

closeModalFunction: () => void - Function to close the modal.

message: string | null - Message to display inside the modal.

confirmBtn: string | null - Text for the close button.

xBtn: string | null - Text for the "X" close button.

handleConfirmClick () => void - Function to execute when the close button is clicked.

📝 Example Usage

Here is an example usage of the Modal component directly:

import React, { useState } from 'react';

import {Modal} from 'modal-react-vite-ts';


const Example: React.FC = () => {
  const [isModalOpen, setIsModalOpen] = useState(false);
  const openModal = () => {
    setIsModalOpen(true);
  };
  const closeModal = () => {
    setIsModalOpen(false);
  };
  return (
    <div>
      <button onClick={openModal}>Show Modal</button>
      {isModalOpen && (
        <Modal
          closeModalFunction={closeModal}
          message="This is a modal message"
          confirmBtn="close"
          xBtn="X"
          handleConfirmClick={closeModal}
        />
      )}
    </div>
  );
};

export default Example;

Author

Name: Imene Ikhlef Yahiaoui

Email: ikhlefyahiaoui.imene@gmail.com

License

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

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago