Skip to content

Update Code groups page #878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions components/code-groups.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
title: "Code groups"
description: "The CodeGroup component lets you combine code blocks in a display separated by tabs"
description: "Display multiple code examples in a tabbed interface"
icon: "group"
---

You will need to make [Code Blocks](/code) then add the `<CodeGroup>` component around them. Every Code Block must have a filename because we use the names for the tab buttons.

See below for an example of the end result.
Use the `CodeGroup` component to display multiple code blocks in a tabbed interface, making it easy for users to compare implementations across different programming languages or see alternative approaches to the same task.

<CodeGroup>

Expand All @@ -28,9 +26,9 @@ class HelloWorld {

</CodeGroup>

<RequestExample>
To create a code group, wrap multiple code blocks with `<CodeGroup>` tags. Each code block must include a title, which becomes the tab label.

````mdx Code Group Example
````mdx
<CodeGroup>

```javascript helloWorld.js
Expand All @@ -51,5 +49,3 @@ class HelloWorld {

</CodeGroup>
````

</RequestExample>