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: docs/syntax/dropdowns.md
+31-11Lines changed: 31 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,6 @@ Dropdowns allow you to hide and reveal content on user interaction. By default,
10
10
::::{tab-item} Output
11
11
12
12
:::{dropdown} Dropdown Title
13
-
:name: basic-dropdown
14
13
Dropdown content
15
14
:::
16
15
@@ -19,7 +18,6 @@ Dropdown content
19
18
::::{tab-item} Markdown
20
19
```markdown
21
20
:::{dropdown} Dropdown Title
22
-
:name: basic-dropdown
23
21
Dropdown content
24
22
:::
25
23
```
@@ -37,7 +35,6 @@ You can specify that the dropdown content should be visible by default. Do this
37
35
38
36
:::{dropdown} Dropdown Title
39
37
:open:
40
-
:name: open-dropdown
41
38
Dropdown content
42
39
:::
43
40
@@ -47,7 +44,6 @@ Dropdown content
47
44
```markdown
48
45
:::{dropdown} Dropdown Title
49
46
:open:
50
-
:name: open-dropdown
51
47
Dropdown content
52
48
:::
53
49
```
@@ -57,7 +53,14 @@ Dropdown content
57
53
58
54
## Deeplinking
59
55
60
-
Dropdowns support deeplinking via anchor links. When you navigate to a URL with a hash that points to a dropdown or content within a dropdown, the dropdown will automatically open.
56
+
Dropdowns support deeplinking via anchor links. When you navigate to a URL with a hash that points to a dropdown or content within a dropdown, the dropdown will automatically open. When you manually open a dropdown that has a name/anchor, the URL will automatically update to reflect the current state.
57
+
58
+
### Features
59
+
60
+
-**Automatic opening**: Navigate to `#dropdown-name` and the dropdown opens automatically
61
+
-**URL updates**: Open a dropdown manually and the URL updates to show the anchor
62
+
-**Nested content**: Link directly to headings or content within dropdowns
63
+
-**Browser navigation**: Proper back/forward button support
61
64
62
65
:::::{tab-set}
63
66
@@ -68,15 +71,18 @@ Dropdowns support deeplinking via anchor links. When you navigate to a URL with
68
71
69
72
This dropdown can be opened by navigating to `#deeplink-example`.
70
73
74
+
When you open this dropdown manually by clicking the title, the URL will automatically update to show `#deeplink-example`.
75
+
71
76
#### Nested Content [#nested-content]
72
77
73
78
You can also link directly to content within dropdowns. This content has the anchor `#nested-content`.
74
79
75
80
:::
76
81
77
-
Test links:
78
-
-[Link to dropdown](#deeplink-example)
79
-
-[Link to nested content](#nested-content)
82
+
**Test the features:**
83
+
-[Link to dropdown](#deeplink-example) - Opens the dropdown and updates URL
84
+
-[Link to nested content](#nested-content) - Opens dropdown and scrolls to nested content
85
+
- Try opening/closing the dropdown manually and watch the URL change
80
86
81
87
::::
82
88
@@ -87,16 +93,30 @@ Test links:
87
93
88
94
This dropdown can be opened by navigating to `#deeplink-example`.
89
95
96
+
When you open this dropdown manually by clicking the title, the URL will automatically update to show `#deeplink-example`.
97
+
90
98
#### Nested Content [#nested-content]
91
99
92
100
You can also link directly to content within dropdowns. This content has the anchor `#nested-content`.
93
101
94
102
:::
95
103
96
-
Test links:
97
-
- [Link to dropdown](#deeplink-example)
98
-
- [Link to nested content](#nested-content)
104
+
**Test the features:**
105
+
- [Link to dropdown](#deeplink-example) - Opens the dropdown and updates URL
106
+
- [Link to nested content](#nested-content) - Opens dropdown and scrolls to nested content
107
+
- Try opening/closing the dropdown manually and watch the URL change
99
108
```
100
109
::::
101
110
102
111
:::::
112
+
113
+
### Use Cases
114
+
115
+
Deeplinking is particularly useful for:
116
+
117
+
-**FAQ sections**: Allow users to share links to specific questions
118
+
-**Documentation**: Link directly to explanations that might be collapsed by default
119
+
-**Troubleshooting guides**: Share direct links to specific solutions
120
+
-**API documentation**: Link to specific endpoint details within collapsed sections
121
+
122
+
The URL behaves just like clicking on a heading with an anchor - it updates automatically when you interact with the content.
0 commit comments