1.0.13 • Published 9 months ago

@precooked/react-modal v1.0.13

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@precooked/react-modal

Precooked Logo

@precooked/react-modal is a flexible modal component for React projects. It includes customizable options for styles, close button, and supports fullscreen mode.

Installation

npm install @precooked/react-modal

Props

PropTypeDefaultDescription
isOpenbooleanrequiredControls the modal's visibility.
onClose() => voidrequiredCallback function to close the modal.
childrenReact.ReactNoderequiredContent to display within the modal.
backdropStylesReact.CSSPropertiesundefinedCustom styles for the modal's backdrop.
windowStylesReact.CSSPropertiesundefinedCustom styles for the modal window.
closeButtonStylesReact.CSSPropertiesundefinedCustom styles for the close button.
closeIconstring"close"Icon for the close button.
closeIconPathsany[]undefinedCustom paths for DynamicIcon if needed for the close button.
closeIconSizenumber24Size of the close button icon.
zIndexnumber999The z-index of the modal.
idstringundefinedOptional ID for the modal's root element.
fullScreenbooleanfalseWhen true, the modal takes up the full screen width and height.

Example Usage

import React, { useState } from 'react';
import Modal from '@precooked/react-modal';

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

    return (
        <div>
            <button onClick={() => setIsOpen(true)}>Open Modal</button>
            <Modal
                isOpen={isOpen}
                onClose={() => setIsOpen(false)}
                fullScreen={true}
                backdropStyles={{ backgroundColor: "rgba(0, 0, 0, 0.6)" }}
                windowStyles={{ borderRadius: "10px" }}
                closeIcon="times"
            >
                <h2>Modal Content</h2>
                <p>This is an example of content inside the modal.</p>
            </Modal>
        </div>
    );
};

export default MyComponent;

License

MIT


For more information, visit Precooked.

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago