Log in Request my site

Tabs

The Tabs block shows several pieces of content in the same place: the visitor moves from one to another with a tab bar. This page describes the blocks that make it up, each of its settings and its behavior on a phone and with the keyboard.

Add the block

Insert the Tabs block (Add a block). It comes with its navigation bar, its panels area and a first tab. You write the content in the panels: the bar builds itself from them.

To add a tab, you have three ways. Each creates a panel and its tab in the bar at the right position.

  • The Add tab button, under the block, adds the tab at the end. It appears when the Tabs block or one of its blocks is selected.
  • The + of the panels area adds a tab without opening the block list.
  • On a panel, Add before or Add after in the block’s ⋮ menu, or Ctrl+Alt+T and Ctrl+Alt+Y, add a tab just before or just after.

Delete or move a panel: its tab follows. The bar is not edited by hand.

The blocks that make up the tabs

The blocks of the Tabs block
BlockRoleStates
Tabs navigationThe bar, a row that you lay out in its Flex layout panel. It accepts a Container before the tab strip and another after.Default, Hover
Tabs stripThe tabs and the arrows, in the bar.Default, Hover
Tab navigation itemA tab. It accepts text, an icon or an image.Default, Hover, Focus, Active
Tab shape indicatorA pill-shaped tab, with the Shapes navigation style.Default, Hover
Tabs panelsThe area that holds the panels.Default, Hover
Tab panelThe content of a tab. It accepts any block.Default, Hover, Active
Navigation buttonThe previous and next arrows. An arrow accepts a text, an icon or a Container.Default, Hover, Focus, Disabled

Set the tabs

Select the Tabs block, open the Settings tab then the Tabs settings panel. Some settings appear only with a rotation method, an arrow position or another setting: the Effect column says so.

The Tabs settings panel
SettingEffectDefault value
Navigation styleContent blocks: each tab is composed of blocks (text, icon, image). Shapes: each tab is a shape whose color, size and border you set.Content blocks
Default active tabThe tab open when the page loads. No active tab opens no panel until the visitor chooses a tab.Tab 1
Show the previous and next panelsLines the panels up side by side: the open panel in the middle, its neighbors extending past the edges. The visitor clicks a neighbor to open it.Off
Rotation methodManual: the visitor chooses the tab. Auto: the tabs change on their own, at a regular interval. Both: the tabs change on their own and the visitor can choose.Manual
Navigation positionPlaces the bar at the Top, Right, Bottom or Left of the panels.Top
Disable arrow navigationRemoves the previous and next arrows. In Manual or Both mode.Off
Arrow buttons placementIn the navigation bar or Around the panels. When the arrows are shown.In the navigation bar
Overlay arrowsPlaces the arrows over the content of the panels instead of beside it. With the arrows Around the panels.Off
LoopFrom the last tab, next goes back to the first. When off, the arrows and the keyboard stop at both ends. The arrow at the end of its travel then takes its Disabled state. In Manual or Both mode.On
Swipe on touch screensA horizontal swipe on the panels opens the next or previous tab. In Manual or Both mode.Off
Show a pause buttonPlaces a button that stops the rotation. In Auto or Both mode.On
Random rotation timePicks the interval between two tabs at random, between a minimum and a maximum. In Auto or Both mode.Off
Rotation time (ms)The display time of a tab, from 500 to 10,000 ms.2,000 ms
Minimum rotation time (ms) and Maximum rotation time (ms)The bounds of the randomly picked interval, from 500 to 10,000 ms. With Random rotation time.2,000 ms and 3,000 ms
The Tabs settings panel in Manual mode: Navigation style set to Content blocks, Default active tab set to Tab 1, Show the previous and next panels, Rotation method, Navigation position set to Top, then the arrow settings, Loop turned on and Swipe on touch screens.

Colors, typography, size, borders and animations are set as on any block: see Color a block, Format text, Set size, borders and effects and Animate a block.

Automatic rotation

In Auto or Both mode, the tabs get a pause button. Content that moves on its own for more than five seconds must be stoppable. A screen reader announces this button as Pause the rotation.

If you turn off Show a pause button, the panel shows a warning: without a button, these tabs fail WCAG criterion 2.2.2 (level A). The editor’s Accessibility panel flags the same defect.

Style the tabs

On insertion, each tab receives the registered style Tab and each panel the style Tab panel. With the Content blocks navigation style, the open tab carries a 2 px line under its label and takes your main color. The other tabs carry the same line, transparent, so the text does not move when the tab changes.

To change this appearance, select a tab, choose the Active state in the Styles tab and set its color, border or background. Update the Tab style so that all the tabs of the site follow (Save a block’s style).

The Tabs part of the design catalog gives a look to all the tabs of the site: Underline, Pills, Tinted pills, Segmented, Boxed or Edge (Adopt a design from the catalog). To space the tabs apart, apply the Spaced style to the tab strip, a gap of 8 px (Space your blocks).

How a panel appears

Each panel receives at creation a Fade in animation of 600 ms, triggered When activated and set to Replay. It plays each time the panel opens. You find it in the panel’s Animations tab.

  • For another effect, select the panel and replace the fade in the Animations tab. Each panel can have its own.
  • For an opening with no effect, delete the animation: the panel appears at once.
  • With Show the previous and next panels, the panels do not have this fade: it would make the neighbors invisible. An animation that you placed yourself stays.

The display of the open panel and the hiding of the others are handled by the block. On a panel, the Hide this block checkbox in the Styles tab is grayed out.

The neighboring panels

With Show the previous and next panels, the tabs show a row: the open panel in the middle, a bit of its two neighbors at the edges.

  • A panel takes up 80% of the row until you give it another width.
  • The panel’s Default state styles the neighbors, its Active state the open panel. An opacity of 50% in the Default state dims the neighbors.
  • With Loop, the last panel has the first as a neighbor. Without it, the first has no neighbor on the left nor the last on the right.
  • The neighbors cannot be read with the keyboard or by a screen reader: they are reached through the tabs.

On a phone

Placed at the top or bottom of the panels, the tab strip stays on a single row. The labels tighten first, even if that means going onto two lines. When there is no room left, the strip scrolls sideways. The arrows stay at both ends of the bar and the tab they open returns to the center.

  • For tabs on several rows, select the tab strip and turn on Wrap in its layout, screen by screen.
  • The tabs scroll behind the arrows: give the arrows a background in their style.
  • Placed on a side, the bar is a column that extends downward.
  • With Swipe on touch screens, a horizontal swipe of at least 40 px on the panels changes tab. A swipe that is more vertical than horizontal scrolls the page.

Tabs as an accordion on a phone

To show each tab followed by its panel on a phone, dissolve the strip and the panels area on that screen.

  1. Select the Tabs strip. In its Flex layout panel, choose the Mobile screen then turn on Dissolve on this screen.
  2. Select the Tabs panels. In their Dissolve panel, turn on Mobile.
  3. Select the Tabs block. Its Grid layout panel lists the tabs and the panels. Give each its order on Mobile: tab 1, panel 1, tab 2, panel 2.

On this screen, the closed panel leaves the page and the open panel appears with no fade. The arrows disappear. With the keyboard and a screen reader, they are still tabs.

Accessibility

The block follows the tabs pattern that assistive technologies expect. You have nothing to turn on.

Tabs with the keyboard
KeyEffect
TabEnters the bar. The whole bar counts as a single stop.
← and →Opens the previous or next tab and gives it focus. Without Loop, stops at both ends.
Enter or SpaceOpens the tab that has focus.
Tab from the barGoes to the open panel, then to its content.

A screen reader announces the tab’s position and its state, links each tab to its panel and does not read the closed panels. The bar’s arrows stay clickable with the mouse but leave the keyboard order: ← and → do the same thing.

An arrow that contains several stacked labels, one per tab, must hide the others with Hide this block. An opacity is not enough: a screen reader reads all the text of the button.

A block before or after the tabs

The bar accepts a Container before the tab strip and another after. The Tabs block gives the Active state to the first when the first tab is open. It gives it to the second when the last tab is. You can style it in this state, hide it in the Default state with Hide this block or animate it When activated.

For example, in a five-tab story without Loop, a Container after the strip holds a button hidden in the Default state. On the next arrow, check Hide this block in the Disabled state. At the last tab, the arrow disappears and the button takes its place.

See also

Updated on

All documentation pages