Skip to main content
OwnDocs

Code Groups

1 min readStableBeginner

The Code Group component organizes multiple code blocks into a tabbed interface. The title from each block's metastring becomes the tab label.

Quick Start

Two package manager options.

npm
Bash
npm install next react react-dom

Adding Options

Three options for a common task.

npm
Bash
npm install next react react-dom

Advanced

Show the same logic in different languages.

JavaScript
JavaScript
const greeting = 'Hello, World!'
console.log(greeting)

Options

The tab label comes from each child code block, resolved in this order:

  1. title (recommended)
  2. language
  3. aria-label (with the " code block" suffix stripped)
  4. "Tab N" fallback
titlestringDefault: language

Sets the tab label from the block's metastring and overrides the other sources.

Was this page helpful?