Markdown
This field lets you display markdown content. It supports GitHub Flavored Markdown.
Usage
Let's see how we can use <MarkdownField>
in a show page.
pages/posts/show.tsx
import {
useShow,
Show,
Typography,
IResourceComponentsProps,
MarkdownField,
} from "@pankod/refine";
const { Title, Text } = Typography;
export const PostShow: React.FC = () => {
const { queryResult } = useShow<IPost>();
const { data, isLoading } = queryResult;
const record = data?.data;
return (
<Show isLoading={isLoading}>
<Title level={5}>Id</Title>
<Text>{record?.id}</Text>
<Title level={5}>Content</Title>
<MarkdownField value={record?.content} />
</Show>
);
};
interface IPost {
id: string;
title: string;
content: string;
}
API Reference
Properties
Property | Description | Type |
---|---|---|
value | Markdown data to render | string | undefined |