Skip to main content
Version: 4.xx.xx
Swizzle Ready

Markdown

This field lets you display markdown content. It supports GitHub Flavored Markdown.

Good to know:

You can swizzle this component with the Refine CLI to customize it.

Usageโ€‹

Let's see how we can use <MarkdownField> in a show page.

// visible-block-start
import React from "react";
import { useShow } from "@refinedev/core";
import {
Show,
TextFieldComponent as TextField,
MarkdownField,
} from "@refinedev/mui";
import { Stack, Typography } from "@mui/material";

const SampleShow = () => {
const {
queryResult: { data, isLoading },
} = useShow();
const record = data?.data;

return (
<Show isLoading={isLoading}>
<Stack gap={1}>
<Typography variant="body1" fontWeight="bold">
Title
</Typography>
<TextField value={record?.title} />
<Typography variant="body1" fontWeight="bold">
Content
</Typography>
<MarkdownField value={record?.content} />
</Stack>
</Show>
);
};
// visible-block-end

Show.defaultProps = { breadcrumb: false };

render(
<RefineMuiDemo
initialRoutes={["/samples", "/samples/show/123"]}
resources={[
{
name: "samples",
show: SampleShow,
list: () => (
<div>
<p>This page is empty.</p>
<RefineMui.ShowButton recordItemId="123">
Show Item 123
</RefineMui.ShowButton>
</div>
),
},
]}
/>,
);

API Referenceโ€‹

Propertiesโ€‹

Exampleโ€‹

Run on your local
npm create refine-app@latest -- --example input-custom