mirror of
https://github.com/upstash/context7.git
synced 2026-09-14 19:09:34 +08:00
6d777619c2
Co-authored-by: Context7 Agent <docs-agent@context7.com> Co-authored-by: Josh <josh@upstash.com> Co-authored-by: context7[bot] <236830434+context7[bot]@users.noreply.github.com>
27 lines
558 B
Plaintext
27 lines
558 B
Plaintext
---
|
|
title: React components
|
|
description: Define a small custom component in MDX
|
|
---
|
|
|
|
Define the component with an ESM export, then use it in the page.
|
|
|
|
## Usage
|
|
|
|
```mdx
|
|
export const Status = ({ children }) => (
|
|
<Badge color="green">{children}</Badge>
|
|
)
|
|
|
|
The API is <Status>ready</Status>.
|
|
```
|
|
|
|
Keep custom components small. Use a shared MDX or JSX snippet when several pages need the same component.
|
|
|
|
## Example
|
|
|
|
export const ExampleStatus = ({ children }) => (
|
|
<Badge color="green">{children}</Badge>
|
|
)
|
|
|
|
The API is <ExampleStatus>ready</ExampleStatus>.
|