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
description: 'Create custom anchor links within your documentation pages'
2
+
title: Anchor
3
+
description: Create linkable anchors for paragraphs, tables, and other content without headings
4
4
---
5
5
6
-
The Anchor component allows you to create custom anchor points within your documentation that can be linked to directly. This is useful for creating deep links to specific sections of content that don't have headings.
6
+
Use the `<Anchor>` component to create links to specific paragraphs, tables, and other sections of content that don't have headings. Wrap your content with the `<Anchor>` tag and assign it a custom anchor ID, which you can link to in URLs using the hash symbol (example: `https://website.com/page#data`).
7
7
8
-
## Usage
9
-
10
-
Use the `<Anchor>` component to wrap content and assign it a custom anchor ID. The anchor ID can then be referenced in URLs using the hash symbol (`#`).
8
+
<Note>
9
+
Headings automatically generate anchor links based on their text content, so you don't need to use the `<Anchor>` component for headings.
10
+
</Note>
11
11
12
12
<Tabs>
13
-
<Tabtitle="Rendered">
14
-
<Anchorid="data">This content has a custom anchor</Anchor>
13
+
<Tabtitle="Basic anchor">
14
+
15
+
<Anchorid="data">This sentence has a custom anchor</Anchor>
15
16
16
17
You can link to it using `#data` in the URL.
17
18
</Tab>
18
19
<Tabtitle="Markdown">
20
+
19
21
```jsx
20
-
<Anchor id="data">This content has a custom anchor</Anchor>
22
+
<Anchor id="data">This sentence has a custom anchor</Anchor>
21
23
22
24
You can link to it using `#data`in the URL.
23
25
```
24
26
</Tab>
25
27
</Tabs>
26
28
27
-
## Properties
28
-
29
-
<ParamFieldpath="id"type="string"required={true}>
30
-
The anchor ID to assign to this content. This will be used in the URL hash (e.g., `#data`)
31
-
</ParamField>
32
-
33
-
## Examples
34
-
35
-
### Anchor with a table
36
-
37
29
<Tabs>
38
-
<Tabtitle="Rendered">
30
+
<Tabtitle="Anchor a table">
39
31
<Anchorid="api-endpoints">
40
32
41
33
| Endpoint | Method | Description |
@@ -49,6 +41,7 @@ You can link to it using `#data` in the URL.
49
41
You can link directly to the [API endpoints table](#api-endpoints).
50
42
</Tab>
51
43
<Tabtitle="Markdown">
44
+
52
45
```jsx
53
46
<Anchor id="api-endpoints">
54
47
@@ -65,10 +58,8 @@ You can link directly to the [API endpoints table](#api-endpoints).
65
58
</Tab>
66
59
</Tabs>
67
60
68
-
### Anchor with a code block
69
-
70
61
<Tabs>
71
-
<Tabtitle="Rendered">
62
+
<Tabtitle="Anchor a Code Block">
72
63
<Anchorid="example-code">
73
64
74
65
```python
@@ -83,6 +74,7 @@ def authenticate(api_key):
83
74
Reference the [authentication code example](#example-code) in your implementation.
84
75
</Tab>
85
76
<Tabtitle="Markdown">
77
+
86
78
````jsx
87
79
<Anchor id="example-code">
88
80
@@ -100,15 +92,10 @@ Reference the [authentication code example](#example-code) in your implementatio
100
92
</Tab>
101
93
</Tabs>
102
94
103
-
## Use Cases
95
+
## Properties
104
96
105
-
The Anchor component is particularly useful for:
97
+
<ParamFieldpath="id"type="string"required={true}>
98
+
The anchor ID for this content. Reference it in URLs using the hash (example: `#data`)
99
+
</ParamField>
106
100
107
-
- Creating links to specific paragraphs or content blocks that don't have headings
108
-
- Providing deep links to important information within a page
109
-
- Building table of contents or navigation that references specific content
110
-
- Enabling users to share links to exact locations in your documentation
111
101
112
-
<Note>
113
-
Headings automatically generate anchor links based on their text content, so you don't need to use the Anchor component for headings. Use Anchor for non-heading content that you want to make linkable.
0 commit comments