Code Block Group
Let readers switch between equivalent code examples in one place.
Loading documentation…
CodeBlockGroup groups equivalent CodeBlock examples behind tabs. It keeps a
guide compact when readers can choose among package managers, frameworks,
operating systems, or API languages without duplicating the surrounding
explanation.
Each child block uses its title as its tab label. The first block is active by
default; provide defaultValue to open another block. Keep every tab equivalent
in purpose so switching does not conceal a required step.
The group's copy control always copies the currently active source. Use a
separate CodeBlock when examples are not alternatives and readers need to see
all of them at once.
Use a group for alternatives that differ in syntax but lead to the same result. This example makes the preferred package manager visible first while keeping the other options one click away.
Direct CodeBlock elements to present as alternatives.
The tab value to open initially. Values are derived from each block's title, language, or fallback option label. It defaults to the first block.
Selects the tab appearance. It defaults to line.
Extra classes applied to the grouped code container.