Artefact UI

Search

Blog

Docs

About

Playground

MenuChevron Down

Blog

Docs

About

Playground

Tabs - Docs - Artefact

Tabs

Navigation
Conditionally-interactive

Introduction

A visual layout component that organizes dense, related information into multiple, mutually exclusive panels. Users can seamlessly switch between panels without loading new pages or cluttering the layout canvas.

The Tabs component is fully integrated as a tabs block in the Page Builder, allowing content authors and developers to easily construct tabbed views, configure visual properties, and arrange nested blocks directly inside Sveltia CMS page templates.


Usage

These configurations represent exactly how page-builder block items are constructed.

1. Classic Horizontal Tabs (Line Variant)

Our standard layout featuring an under-lined trigger indicator and smooth sliding transitions. Perfect for standard product features, details, or documentation sub-menus.

{
  "type": "tabs",
  "variant": "line",
  "size": "md",
  "items": [
    {
      "value": "features",
      "label": "⚡ Key Features",
      "content": [
        {
          "type": "text",
          "content": "Our Hono/JSX Tabs component supports zero runtime styled-system classes, smooth sliding indicator transitions, and native keyboard interaction."
        }
      ]
    },
    {
      "value": "pricing",
      "label": "💎 Pricing Plans",
      "content": [
        {
          "type": "text",
          "content": "Flexible subscription pricing for individuals, start-ups, and scaling enterprise workspaces."
        }
      ]
    }
  ]
}

Our Hono/JSX Tabs component supports zero runtime styled-system classes, smooth sliding indicator transitions, and native keyboard interaction.

2. Enclosed Folder Style (Compact Sizing)

Renders the tabs list with bordered button enclosures resembling folder dividers. Excellent for dashboard menus, interface preferences, or compact settings sections.

{
  "type": "tabs",
  "variant": "enclosed",
  "size": "sm",
  "items": [
    {
      "value": "profile",
      "label": "User Profile",
      "content": [
        {
          "type": "text",
          "content": "Manage personal information, billing details, and customized regional preferences."
        }
      ]
    },
    {
      "value": "security",
      "label": "Security",
      "content": [
        {
          "type": "text",
          "content": "Configure multi-factor authentication codes, view active sessions, and update credentials."
        }
      ]
    }
  ]
}

Manage personal information, billing details, and customized regional preferences.


Props

PropertyCMS Field TypeDefaultDescription / Supported Options
Tab Items (items)list-Array of tab blocks. Each item requires a unique value (for key tracking), label text, and a content block list containing child layout nodes.
Visual Variant (variant)select"line"Visual appearance style.
"line" — Minimal textual triggers with an underlined slide indicator.
"subtle" — Shaded, rounded backdrop tags.
"enclosed" — Traditional bordered folder tab design.
Size Scale (size)select"md"Controls paddings, spacing, and trigger label font size.
• Options: "xs", "sm", "md", "lg".
Orientation (orientation)select"horizontal"Structural axis direction of the trigger list. Can be "horizontal" or "vertical".
Activation Mode (activationMode)select"automatic""automatic" — Panel content switches instantly as triggers receive keyboard focus.
"manual" — Panel contents only update upon explicit pressing of the Spacebar or Enter keys.
Roving Loop (loopFocus)booleantrueContinues cycling keyboard focus back around to the first item when pressing Arrow keys past the end.
Lazy Mounting (lazyMount)booleanfalseDefers rendering inactive tab panels until their specific trigger button is visited for the first time.

Accessibility & Developer Notes

This component complies with the WAI-ARIA Tabs Design Pattern out-of-the-box. When hydrated, the component implements the following critical accessibility layers:

  • Semantic Role Assignment: Sets role="tablist" on the list container and role="tab" on triggers, with aria-selected reflecting active state, and aria-controls referencing panel IDs automatically.
  • Roving Focus Navigation: Keyboard arrow keys smoothly navigate triggers with focus-roving tabIndex. Pressing Home or End jumps immediately to endpoints.
  • Dynamic CSS Sliding Indicator: Features an absolute visual slider indicator. It queries position metrics from the active trigger element to animate translations smoothly without triggering layout thrashing.
  • Bypassing Hono Reconciler Limits: In Preact islands wrapping static HTML, the state manager directly manipulates trigger attributes (like data-selected, aria-selected, tabindex, and hidden) on events to guarantee performance independent of the reconciler timeline.