You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@mantine/modals

Package Overview
Dependencies
Maintainers
1
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mantine/modals

Modals manager based on Mantine components

8.1.3
latest
Source
npmnpm
Version published
Weekly downloads
174K
-0.62%
Maintainers
1
Weekly downloads
 
Created

What is @mantine/modals?

@mantine/modals is a package that provides a set of modal components for React applications. It is part of the Mantine library, which offers a comprehensive collection of UI components and hooks for building modern web applications. The modals package allows developers to create various types of modal dialogs with ease, including confirmation dialogs, form modals, and more.

What are @mantine/modals's main functionalities?

Basic Modal

This code demonstrates how to create a basic modal using the @mantine/modals package. The modal can be opened and closed by updating the state.

import { Modal, Button } from '@mantine/core';
import { useState } from 'react';

function BasicModal() {
  const [opened, setOpened] = useState(false);

  return (
    <>
      <Button onClick={() => setOpened(true)}>Open Modal</Button>
      <Modal opened={opened} onClose={() => setOpened(false)} title="Basic Modal">
        <div>Content of the modal</div>
      </Modal>
    </>
  );
}

Confirmation Modal

This code demonstrates how to create a confirmation modal using the @mantine/modals package. The modal asks the user to confirm an action and logs a message when confirmed.

import { Button } from '@mantine/core';
import { openConfirmModal } from '@mantine/modals';

function ConfirmationModal() {
  const openModal = () => {
    openConfirmModal({
      title: 'Please confirm your action',
      children: <p>Are you sure you want to proceed?</p>,
      labels: { confirm: 'Yes', cancel: 'No' },
      onConfirm: () => console.log('Confirmed'),
    });
  };

  return <Button onClick={openModal}>Open Confirmation Modal</Button>;
}

Form Modal

This code demonstrates how to create a form modal using the @mantine/modals package. The modal contains a text input and a submit button, and logs the input value when the form is submitted.

import { Modal, Button, TextInput } from '@mantine/core';
import { useState } from 'react';

function FormModal() {
  const [opened, setOpened] = useState(false);
  const [value, setValue] = useState('');

  const handleSubmit = () => {
    console.log('Form submitted with value:', value);
    setOpened(false);
  };

  return (
    <>
      <Button onClick={() => setOpened(true)}>Open Form Modal</Button>
      <Modal opened={opened} onClose={() => setOpened(false)} title="Form Modal">
        <TextInput value={value} onChange={(event) => setValue(event.currentTarget.value)} label="Your input" />
        <Button onClick={handleSubmit}>Submit</Button>
      </Modal>
    </>
  );
}

Other packages similar to @mantine/modals

Keywords

components

FAQs

Package last updated on 07 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts