1.1.5 • Published 1 year ago

parallax-item v1.1.5

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

NPM npm

SpModal

A modal component for React applications. The modal can be opened and closed by controlling the visible prop, and can have a custom title and body content.

Contains:

  • Children
  • Title
  • Close button

Installation

To install:

npm install sp-modal

Usage

To use the component, import it into your React code and pass in the necessary props:

import SpModal from 'sp-modal';

function MyComponent() {
    const [modalVisible, setModalVisible] = useState(false);

    return (
        <div>
            <button onClick={() => setModalVisible(true)}>Open Modal</button>
            <SpModal
                visible={modalVisible}
                closeHandler={() => setModalVisible(false)}
                title="Modal Title"
            >
                <p>Modal Body</p>
            </SpModal>
        </div>
    );
}

The visible prop controls whether the modal is open or closed, and the closeHandler prop is a function that is called when the modal is closed. The title prop is an optional prop that can be used to set a custom title for the modal, and the modal's body content is passed in as the component's children.

3 possibilities to close the modal:

  • modal close button
  • escape keyboard key
  • when you click outside the modal

License

This project is licensed under the MIT License - see the LICENSE file for details

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.11

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.91

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago