You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/examples.mdx
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,27 @@
1
1
---
2
2
title: "Examples"
3
-
description: "Display code blocks at the top-right of the page on desktop devices"
3
+
description: "Display code blocks in the right sidebar on desktop devices"
4
4
icon: 'between-horizontal-start'
5
5
---
6
6
7
-
The `<RequestExample>` and `<ResponseExample>`stick code blocks to the top-right of a page even as you scroll. The components work on all pages even if you don't use an API playground.
7
+
The `<RequestExample>` and `<ResponseExample>`components display code blocks in the right sidebar to create a two-column layout that keeps examples visible while users scroll through your content. These components are designed for API documentation, but they work on all pages.
8
8
9
-
`<RequestExample>` and `<ResponseExample>` show up like regular code blocks on mobile.
9
+
Common use cases:
10
10
11
-
## Request Example
11
+
- API endpoint documentation with request and response examples
12
+
- Configuration examples alongside explanatory text
13
+
- Code samples that users reference while following instructions
14
+
- Before and after examples in tutorials
12
15
13
-
The `<RequestExample>`component works similar to [CodeGroup](/components/code-groups), but displays the request content on the right sidebar. Thus, you can put multiple code blocks inside `<RequestExample>`.
16
+
On mobile devices, `<RequestExample>`and `<ResponseExample>`components display as regular code blocks and can be scrolled past.
14
17
15
-
Please set a name on every code block you put inside RequestExample.
18
+
## RequestExample
16
19
17
-
<RequestExample>
18
-
````mdx RequestExample Example
20
+
Use `<RequestExample>` to pins code examples in the right sidebar. This component works similarly to the [CodeGroup](/components/code-groups) component, but displays the code in the sidebar instead of inline.
21
+
22
+
You can include multiple code blocks inside a single `<RequestExample>`. Each code block must have a title attribute.
23
+
24
+
````mdx RequestExample
19
25
<RequestExample>
20
26
21
27
```bash Request
@@ -25,14 +31,12 @@ Please set a name on every code block you put inside RequestExample.
25
31
26
32
</RequestExample>
27
33
````
28
-
</RequestExample>
29
34
30
-
## Response Example
35
+
## ResponseExample
31
36
32
-
The `<ResponseExample>` component is the same as `<RequestExample>`but will show up underneath it.
37
+
The `<ResponseExample>` component pins code examples in the right sidebar beneath any `<RequestExample>`content on the same page.
33
38
34
-
<ResponseExample>
35
-
````mdx ResponseExample Example
39
+
````mdx ResponseExample
36
40
<ResponseExample>
37
41
38
42
```json Response
@@ -41,4 +45,3 @@ The `<ResponseExample>` component is the same as `<RequestExample>` but will sho
0 commit comments