Skip to content
Content Blocks docsv0.8.0Website

Docs / Components

<content-tabs>

Accessible tabs: a tablist of buttons and the panels they show, with arrow key support.

Import it on its own, for a bundler
import '@content-blocks/js/components/content-tabs';

Examples

Tabs

The tabs follow the WAI-ARIA pattern, so the arrow keys move between them.

Open on its own
Coiled around the world, and rising from the sea.

Anatomy

Content goes into the component's slots, chosen with the slot attribute on each child.

flowchart LR
  root["#lt;content-tabs#gt;"]:::component
  root --> s0["<b>no slot (default)</b><br/>Default slot, same as content slot."]
  root --> s1["<b>slot=#quot;content#quot;</b><br/>This slot will usually serve specific markup to ensure tabs are acces…"]
  classDef component fill:#141413,color:#faf9f5,stroke:#141413
The slots of <content-tabs>
SlotWhat goes in it
(default)Default slot, same as content slot.
slot="content"This slot will usually serve specific markup to ensure tabs are accessible.

Properties

Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.

AttributeTypeDefaultDescription
classesresponsiveString–Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side".
paddingresponsiveString–Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem".