Skip to main content

Modal

The Modal component is a dialog box that appears on top of the main content, used to display important information or prompt user interaction.

Basic Usage

import { Modal, ThemeProvider } from "@carton-org/react-neumorphism";
import { useState } from "react";

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

return (
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)} title="Modal Title">
Modal content goes here
</Modal>
);
};

Live Example

Props

NameTypeDescriptionRequiredDefault Value
widthnumberWidth of the modal in pixelsNo-
heightnumberHeight of the modal in pixelsNo-
isOpenbooleanWhether the modal is visibleYes-
onClose() => voidCallback function when modal is closedNo-
titlestringTitle text displayed at the top of the modalNo-
childrenReact.ReactNodeContent to be displayed inside the modalYes-

Examples

With Custom Dimensions

Without Title