npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mui-react-modal

v1.0.2

Published

Create responsive modal and dialog in react using mui.

Downloads

16

Readme

mui-react-modal

Creating a Custom Modal and Dialog Component with MUI (Material-UI) in React for Enhanced User Experience.

Install

Using npm

npm i mui-react-modal

Using yarn

yarn add mui-react-modal

Basic Usage for modal

import React, { useState } from 'react';
import { Modal } from 'mui-react-modal';
import { Button } from '@mui/material';

export default function Test() {
    const [open, setOpen] = useState(false);

    const handleModal = () => setOpen(!open);

    const modalAction = <Button variant='outlined' size='small'>Save</Button>
    
    return (
        <>
            <Button onClick={handleModal}>Open Modal</Button>
            <Modal
                open={open}
                title={"Modal heading"}
                description={"Modal description."}
                close={handleModal}
                action={modalAction}
                actionPosition="right"
            />
        </>
    )
}

API & Supported parameters for modal

| Property | Type | Default | Required | Description | | :--- | :--- | :--- | :--- | :--- | | open | Boolean | false | true | Controls whether the modal is open or closed. | | close | Function | null | false | A function to close the modal. | | title | String \|\| Element | null | false | Show modal title. | | description | String \|\| Element | null | false | Show modal description. | | action | Element | null | false | The element to be used as the modal's action button(s). | | closeIcon | Boolean | true | false | Determines whether the modal close icon is visible. | | customStyle | Object | Object | false | A style object that allows customization of the modal's default style. | | actionPosition | String | left | false | The position of the action element(s) within the modal. Supported values are "left" "center"and"right". | | modalRootClass | String | null | false | A CSS class name to modify the default style of the modal root. | | closeIconRootClass | String | null | false | A CSS class name to modify the default style of the close icon. | | titleRootClass | String | null | false | A CSS class name to modify the default style of the modal title. | | descriptionRootClass | String | null | false | A CSS class name to modify the default style of the modal description. | | actionRootClass | String | null | false| A CSS class name to modify the default style of the modal action element(s). | | closeOnBackgroundCheck | Boolean | true | false| Make it false if you don't want to close modal on outside check or background check. |

Basic Usage for dialog

import React, { useState } from 'react';
import { Dialog } from 'mui-react-modal';
import { Button } from '@mui/material';

export default function Test() {
    const [open, setOpen] = useState(false);

    const handleDialog = () => setOpen(!open);

    const dialogAction = <Button variant='outlined' size='small'>Save</Button>
    
    return (
        <>
            <Button onClick={handleDialog}>Open Dialog Box</Button>
            <Dialog
                open={open}
                title={"Dialog Box Heading"}
                description={"Dialog Box Description."}
                close={handleDialog}
                action={dialogAction}
                actionPosition="right"
            />
        </>
    )
}

API & Supported parameters for dialog

| Property | Type | Default | Required | Description | | :--- | :--- | :--- | :--- | :--- | | open | Boolean | false | true | Controls whether the dialog is open or closed. | | close | Function | null | false | A function to close the dialog. | | title | String \|\| Element | null | false | Show dialog title. | | description | String \|\| Element | null | false | Show dialog description. | | action | Element | null | false | The element to be used as the dialog's action button(s). | | dividers | Boolean | false | false | Controls whether to show dividers between sections in the dialog. | | closeIcon | Boolean | true | false | Controls whether to show a close icon in the dialog header. | | hideBackdrop | String | false | false | Controls whether to hide the backdrop when the dialog is open.| | dialogTitleSx | Object | {} | false | Style object for the dialog title.| | dialogContentSx | Object | {} | false | Style object for the dialog content. | | dialogActionSx | Object | {} | false | Style object for the dialog actions.| | dialogRootSx | Object | {} | false | Style object for the dialog root element.| | closeIconSx | Object | {...} | false | Style object for the close icon. | | fullScreen | Boolean | false | false | Controls whether the dialog should be displayed in full-screen mode. |

Upcoming Features

We are dedicated to continuously enhancing the library to provide an even better user experience.

Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug fixes, feel free to open an issue or submit a pull request.