Skip to content

Commit 7d6a961

Browse files
committed
feat: add custom MDX components for enhanced documentation rendering
1 parent 8165a92 commit 7d6a961

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/site/app/[lang]/docs/[[...slug]]/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import type { Metadata } from 'next';
33
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
44
import { notFound } from 'next/navigation';
55
import { siteConfig } from '@/lib/site-config';
6+
import defaultComponents from 'fumadocs-ui/mdx';
7+
import { Steps, Step } from 'fumadocs-ui/components/steps';
8+
import { Card, Cards } from 'fumadocs-ui/components/card';
9+
import { Callout } from 'fumadocs-ui/components/callout';
610

711
interface PageProps {
812
params: Promise<{
@@ -39,7 +43,7 @@ export default async function Page({ params }: PageProps) {
3943
} : undefined}
4044
>
4145
<DocsBody>
42-
<MDX />
46+
<MDX components={{ ...defaultComponents, Steps, Step, Card, Cards, Callout }} />
4347
</DocsBody>
4448
</DocsPage>
4549
);

packages/site/mdx-components.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import defaultComponents from 'fumadocs-ui/mdx';
22
import type { MDXComponents } from 'mdx/types';
33
import { Steps, Step } from 'fumadocs-ui/components/steps';
4+
import { Card, Cards } from 'fumadocs-ui/components/card';
5+
import { Callout } from 'fumadocs-ui/components/callout';
46

57
export function useMDXComponents(components: MDXComponents): MDXComponents {
68
return {
79
...defaultComponents,
810
Steps,
911
Step,
12+
Card,
13+
Cards,
14+
Callout,
1015
...components,
1116
};
1217
}

0 commit comments

Comments
 (0)