7.6.2 • Published 2 months ago
mantine-modal-manager v7.6.2
Improved Mantine modals manager
This is an extension of @mantine/modals
package with improved modals manager that allows to:
- Open managed modals with full typesafety
- Keeping the state of parent modals when opening nested modals
- Has an improved API for managed modals
Installation
# With yarn
yarn add @mantine/hooks @mantine/core mantine-modal-manager
# With npm
npm install @mantine/hooks @mantine/core mantine-modal-manager
Usage
import { createManagedModal, createModalManager } from 'mantine-modal-manager';
// Define modal props:
type InnerProps = {
title: string;
};
// Create managed modal:
const ExampleModal = createManagedModal<InnerProps>(({ actions, innerProps }) => {
return (
<div>
<p>{innerProps.title}</p>
<button onClick={actions.closeModal}>Close</button>
</div>
);
});
// Somewhere in your app create modal manager:
const [ModalManager, modalEvents] = createModalManager({
example: ExampleModal,
});
// In your layout use the modal:
export const Layout = () => {
return (
<ModalManager>
<YourApp />
</ModalManager>
);
};
// In your app use the modal:
const YourApp = () => {
const openExampleModal = () =>
modalEvents.openManagedModal({
modal: 'example',
innerProps: {
title: 'Hello world',
},
});
return (
<div>
<button onClick={openExampleModal}>Open modal</button>
</div>
);
};
License
MIT
7.6.2
2 months ago
7.6.1
2 months ago
7.6.0
2 months ago
7.5.3
2 months ago
7.5.2
3 months ago
7.5.1
3 months ago
7.5.0
3 months ago
7.4.0
4 months ago
7.3.2
4 months ago
7.3.1
5 months ago
7.3.0
5 months ago
7.1.7
5 months ago
7.1.6
5 months ago
7.1.5
5 months ago
7.1.4
5 months ago
7.2.2
5 months ago
7.1.3
5 months ago
7.2.1
5 months ago
7.1.2
5 months ago
7.2.0
5 months ago
7.1.1
5 months ago
7.1.0
7 months ago
7.0.0
7 months ago
7.0.0-beta.7
7 months ago
7.0.0-beta.6
7 months ago
7.0.0-beta.5
7 months ago
7.0.0-beta.4
7 months ago
7.0.0-beta.3
7 months ago
7.0.0-beta.2
7 months ago
7.0.0-beta.0
7 months ago