React Native Mantine › Overlays
Modal
Full-featured modal dialog
Import: import { Modal } from 'react-native-mantine';
Usage
import { useState } from 'react';
import { Modal, Button, Text } from 'react-native-mantine';
const MyComponent = () => {
const [opened, setOpened] = useState(false);
return (
<>
<Button onPress={() => setOpened(true)}>
Open Modal
</Button>
<Modal
opened={opened}
onClose={() => setOpened(false)}
title="My Modal"
>
<Text>Modal content goes here</Text>
</Modal>
</>
);
};
Props
| Prop | Type | Default | Description |
|---|---|---|---|
opened (required) | boolean | Modal opened state | |
onClose (required) | () => void | Called when modal is closed | |
title | React.ReactNode | Modal title | |
children | React.ReactNode | Modal content | |
size | MantineNumberSize | 'full' | 'md' | Modal size |
padding | SpacingValue | 'md' | Modal padding |
radius | MantineNumberSize | 'md' | Modal border radius |
closeOnClickOutside | boolean | true | If true, pressing the overlay closes the modal |
centered | boolean | false | If true, modal will be centered on screen |
withOverlay | boolean | true | If true, modal will show overlay |
overlayOpacity | number | 0.6 | Overlay opacity |
overlayColor | string | '#000' | Overlay color |
withCloseButton | boolean | true | If true, close button will be shown |
fullScreen | boolean | false | If true, modal will take full screen |
style | any | Additional styles | |
transitionDuration | number | 200 | Animation duration in ms |
zIndex | number | 1000 | Z-index |
accessibilityLabel | string | Accessibility label for the modal | |
testID | string | Test identifier used by testing frameworks |