Skip to main content

Overview

The Tabs plugin allows you to create tabbed content sections, perfect for organizing related information in a compact, user-friendly format. Users can switch between tabs to view different content.

Installation

Basic Usage

Pass the plugin to createYooptaEditor; do not pass plugins to <YooptaEditor>.

Features

  • Multiple Tabs: Create unlimited tabs
  • Active Tab State: Track which tab is currently active
  • Easy Navigation: Switch between tabs effortlessly
  • Keyboard Controls: Add tabs with Enter key
  • Custom Content: Each tab can contain any content

Structure

The Tabs plugin consists of nested elements:

Configuration

Options

object

Element Props

tabs-container

string | null
ID of the currently active tab

tabs-item-content

string | null
ID linking content to its tab heading

Commands

addTabItem

Add a new tab to the tabs container.

removeTabItem

Remove a specific tab (to be implemented).

Keyboard Behavior

  • Enter on Tab Heading: Creates a new tab
  • Enter in Tab Content: Inserts newline within content
  • Backspace: Prevents deletion at content start
  • Cmd/Ctrl+A in Content: Selects entire content

Initial Structure

When created, the plugin initializes with one tab:

Custom Rendering

Styling Examples

Basic CSS

With Icons

Use Cases

Documentation

Different programming language examples

Product Features

Showcase different product features

FAQ Sections

Categorized frequently asked questions

Pricing Plans

Compare different pricing tiers

Best Practices

Use concise, descriptive labels for tabs
Keep number of tabs reasonable (3-7) for better UX
Maintain similar content structure across tabs
Ensure tabs are keyboard navigable
Consider mobile layouts with scrollable tabs

Advanced Patterns

With Tab Icons

With Vertical Layout

With Lazy Loading

Accessibility

The Tabs plugin should follow WAI-ARIA tabs pattern:
  • Tab List: role="tablist"
  • Tab: role="tab", aria-selected
  • Tab Panel: role="tabpanel", hidden