Skip to content

Commit 9c17a78

Browse files
dks333ethanpalm
andauthored
Code group language dropdown (#893)
* add code group dropdowns * fix the title * reviewer edits --------- Co-authored-by: Ethan Palm <[email protected]>
1 parent 4a2308e commit 9c17a78

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

components/code-groups.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,36 @@ class HelloWorld {
2828

2929
</CodeGroup>
3030

31+
## Language dropdown
32+
33+
You can replace the tabs in a code group with a dropdown menu to toggle between languages.
34+
35+
<CodeGroup dropdown>
36+
37+
```javascript helloWorld.js
38+
console.log("Hello World");
39+
```
40+
41+
```python hello_world.py
42+
print('Hello World!')
43+
```
44+
45+
```java HelloWorld.java
46+
class HelloWorld {
47+
public static void main(String[] args) {
48+
System.out.println("Hello, World!");
49+
}
50+
}
51+
```
52+
53+
</CodeGroup>
54+
55+
### Props
56+
57+
<ResponseField name="dropdown" type="boolean">
58+
Whether to show a dropdown button to toggle the code groups with languages as the options.
59+
</ResponseField>
60+
3161
<RequestExample>
3262

3363
````mdx Code Group Example

0 commit comments

Comments
 (0)