New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mantine/modals

Package Overview
Dependencies
Maintainers
0
Versions
277
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

  • 7.17.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
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

FAQs

Package last updated on 01 Mar 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc