MarkdownPreviewModal
A modal that renders a raw markdown string as formatted HTML using react-markdown with the remark-gfm plugin. Useful for displaying documentation, descriptions, or rich text content fetched as markdown.
Props
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| isOpen | boolean | Yes | — | Controls whether the modal is visible. |
| onClose | () => void | Yes | — | Called when the modal closes. |
| title | string | Yes | — | Title for the modal (not currently rendered in the content area). |
| markdownContent | string | Yes | — | The raw markdown string to render. |
| subtitle | string | No | — | Subtitle for the modal. |
| backdropStyle | React.CSSProperties | No | — | Inline styles for the modal backdrop. |
| windowStyle | React.CSSProperties | No | — | Inline styles merged into the modal window. |
| closeButtonStyle | React.CSSProperties | No | — | Styles for the close button. |
| closeIcon | string | No | — | Icon name for the close button. |
| closeIconPaths | any[] | No | — | Custom icon paths for the close button. |
| closeIconSize | number | No | — | Icon size for the close button. |
| zIndex | number | No | 99999 | CSS z-index of the modal overlay. |
| id | string | No | — | HTML id for the modal element. |
| fullScreen | boolean | No | — | When true, the modal occupies the full viewport. |
Usage
Basic
import React from 'react';
import MarkdownPreviewModal from '@/components/modals/MarkdownPreviewModal';
const content = `
# Hello World
This is a **markdown** preview with [GFM](https://github.github.com/gfm/) support.
- Item one
- Item two
`;
export default function Example() {
const [open, setOpen] = React.useState(false);
return (
<>
<button onClick={() => setOpen(true)}>Preview</button>
<MarkdownPreviewModal
isOpen={open}
onClose={() => setOpen(false)}
title="Documentation Preview"
markdownContent={content}
/>
</>
);
}