Install command tabs in WordPress
A dark code block with one tab per package manager, for technical documentation.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Onglets de commandes d'installation
* Description: Un bloc de code sombre avec un onglet par gestionnaire de paquets, pour une documentation technique. Ajoute la composition « Onglets de commandes d'installation » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-onglets-commandes-installation
*<!-- wp:html -->
<div class="ctabs" data-tabs>
<div class="ctabs__list" role="tablist" aria-label="Gestionnaire de paquets" hidden>
<button class="ctabs__tab" type="button" role="tab" id="onglets-commandes-installation-tab-1" aria-selected="true" aria-controls="onglets-commandes-installation-panel-1">npm</button>
<button class="ctabs__tab" type="button" role="tab" id="onglets-commandes-installation-tab-2" aria-selected="false" aria-controls="onglets-commandes-installation-panel-2" tabindex="-1">pnpm</button>
<button class="ctabs__tab" type="button" role="tab" id="onglets-commandes-installation-tab-3" aria-selected="false" aria-controls="onglets-commandes-installation-panel-3" tabindex="-1">Yarn</button>
<button class="ctabs__tab" type="button" role="tab" id="onglets-commandes-installation-tab-4" aria-selected="false" aria-controls="onglets-commandes-installation-panel-4" tabindex="-1">Bun</button>
</div>
<div class="ctabs__panel" role="tabpanel" id="onglets-commandes-installation-panel-1" aria-labelledby="onglets-commandes-installation-tab-1" tabindex="0">
<pre><code><span class="ctabs__prompt" aria-hidden="true">$ </span>npm install @atelier/forms</code></pre>
</div>
<div class="ctabs__panel" role="tabpanel" id="onglets-commandes-installation-panel-2" aria-labelledby="onglets-commandes-installation-tab-2" tabindex="0">(() => {
if (!document.querySelector(".ctabs")) return;
document.querySelectorAll("[data-tabs]").forEach((root) => {
const list = root.querySelector('[role="tablist"]');
const tabs = [...list.querySelectorAll('[role="tab"]')];
const panels = tabs.map((tab) => document.getElementById(tab.getAttribute("aria-controls")));
const vertical = list.getAttribute("aria-orientation") === "vertical";
function select(index, focus) {
tabs.forEach((tab, position) => {
const selected = position === index;
tab.setAttribute("aria-selected", String(selected));:root {
--ct-bg: #11141b;
--ct-bar: #1a1e28;
--ct-text: #e8ebf2;
--ct-muted: #9aa3b5;
--ct-active: #e8ebf2;
--ct-accent: #7dd3fc;
--ct-prompt: #7d8597;
--ct-ring: #7dd3fc;
--demo-onglets-commandes-installation-bg: #eef0f4;
--demo-onglets-commandes-installation-text: #11141b;
}Free component: copy it freely, including for commercial projects.
Other tabs components in WordPress
Tabs components in WordPress
Accessible tabs on large screens that turn into an accordion on phones, with the right ARIA roles in each mode.
- Tailwind
- React
- CSS
- WordPress

Indicative prices sorted by trade in tabs, with the unit of each service, a VAT-inclusive / excl. switch and a free-quote notice.
- Tailwind
- React
- CSS
- WordPress

Underlined tabs
FreeUnderstated tabs with an underlined active tab, to organize the information on a product page.
- Tailwind
- React
- CSS
- WordPress

Two tabs to show different opening hours by season, in a compact card.
- Tailwind
- React
- CSS
- WordPress