Overview

Tabs are used to organize and navigate between sections of content. They feature a horizontal or a vertical list of section text labels with a content panel below or to the right of the component.

Image of open tabs, box tabs, and tabs with overflow buttons

Sample element

Connected clouds Connected clouds panel Elevated apps Elevated apps panel Automated tasks Automated tasks panel

Demo

<link rel="stylesheet" href="demo.css"/>
<script type="module" src="rh-tabs.js"></script>

<form>
<fieldset>
<legend>Theme</legend>
<label><input type="radio" name="theme" value="default" checked> Default</label>
<label><input type="radio" name="theme" value="base"> Base</label>
</fieldset>

<fieldset>
<legend>Box Variant</legend>
<label><input type="radio" name="variant" value="default" checked> Default</label>
<label><input type="radio" name="variant" value="box"> Box</label>
</fieldset>
</form>

<section>
<h2>Default</h2>
<rh-tabs>
<rh-tab id="users" slot="tab">Users</rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab">Containers</rh-tab>
<rh-tab-panel>Containers <a href="#">Focusable element</a></rh-tab-panel>
<rh-tab slot="tab">Database</rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab">Servers</rh-tab>
<rh-tab-panel>Servers</rh-tab-panel>
<rh-tab slot="tab">Cloud</rh-tab>
<rh-tab-panel>Cloud</rh-tab-panel>
</rh-tabs>

<h2>Centered</h2>
<rh-tabs centered>
<rh-tab id="users" slot="tab">Users</rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab">Containers</rh-tab>
<rh-tab-panel>Containers <a href="#">Focusable element</a></rh-tab-panel>
<rh-tab slot="tab">Database</rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab">Servers</rh-tab>
<rh-tab-panel>Servers</rh-tab-panel>
<rh-tab slot="tab">Cloud</rh-tab>
<rh-tab-panel>Cloud</rh-tab-panel>
</rh-tabs>

<h2>Vertical</h2>
<rh-tabs vertical>
<rh-tab id="users" slot="tab">Users</rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab">Containers</rh-tab>
<rh-tab-panel>Containers <a href="#">Focusable element</a></rh-tab-panel>
<rh-tab slot="tab">Database</rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab">Servers</rh-tab>
<rh-tab-panel>Servers</rh-tab-panel>
<rh-tab slot="tab">Cloud</rh-tab>
<rh-tab-panel>Cloud</rh-tab-panel>
</rh-tabs>
</section>

<section>
<h2>Box Inset</h2>
<rh-tabs box="inset" id="inset">
<rh-tab id="users" slot="tab">Users</rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab">Containers</rh-tab>
<rh-tab-panel>Containers <a href="#">Focusable element</a></rh-tab-panel>
<rh-tab slot="tab">Database</rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab">Servers</rh-tab>
<rh-tab-panel>Servers</rh-tab-panel>
<rh-tab slot="tab">Cloud</rh-tab>
<rh-tab-panel>Cloud</rh-tab-panel>
</rh-tabs>
</section>

<section>
<h2>Icons and text</h2>
<rh-tabs>
<rh-tab slot="tab"> Users <pf-icon slot="icon" icon="users" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab"> Containers <pf-icon slot="icon" icon="box-open" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Containers</rh-tab-panel>
<rh-tab slot="tab"> Database <pf-icon slot="icon" icon="database" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab"> Server <pf-icon slot="icon" icon="server" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Server</rh-tab-panel>
<rh-tab slot="tab"> System <pf-icon slot="icon" icon="laptop" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>System</rh-tab-panel>
</rh-tabs>
</section>

<section>
<rh-tabs vertical>
<rh-tab slot="tab"> Users <pf-icon slot="icon" icon="users" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Users</rh-tab-panel>
<rh-tab slot="tab"> Containers <pf-icon slot="icon" icon="box-open" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Containers</rh-tab-panel>
<rh-tab slot="tab"> Database <pf-icon slot="icon" icon="database" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Database</rh-tab-panel>
<rh-tab slot="tab"> Server <pf-icon slot="icon" icon="server" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>Server</rh-tab-panel>
<rh-tab slot="tab"> System <pf-icon slot="icon" icon="laptop" set="fas" size="sm"></pf-icon></rh-tab>
<rh-tab-panel>System</rh-tab-panel>
</rh-tabs>
</section>
View the demo

When to use

  • When you need to group related information into different categories
  • When users need to read sections of content in the same view without leaving the page
  • When you need to group other types of content in the same view like forms, settings, dashboards, etc.
© 2021-2023 Red Hat, Inc. Deploys by Netlify