vue-split-tabs

Vue 3 · Chapter 06

Your host sets the tone.

On this page

The library provides geometry and class hooks, not a required palette or typography. Set CSS custom properties on the root or a host ancestor, and keep layout dimensions aligned with the controller's size estimates.

Focus is visible above the content

Focus and selection marks are positioned elements above overlay content, not just pane borders hidden under an iframe. The hooks are .split-tabs-focus and .split-tabs-selected-mark, with data-pane-of. They appear when there are at least two panes. data-pane-id belongs to actual pane hit targets, not to these decorative marks. The pane excludes the bar: .split-tabs-tabset[data-tabset-id] is the outer box, .split-tabs-bar[data-bar-id] is the sibling bar (with existing strip hooks), and .split-tabs-pane[data-pane-id] is content only.

Choose one of these recipes on a host class applied around the root. Selected opacity can be adjusted independently when selection should remain more prominent than other unfocused panes.

Border only

.workspace {
  --split-tabs-focus-border: 2px solid #168b77;
  --split-tabs-unfocused-opacity: 1;
  --split-tabs-focused-opacity: 1;
  --split-tabs-selected-border: 2px dashed #bd7d16;
}

Dim other panes

.workspace {
  --split-tabs-focus-border: none;
  --split-tabs-unfocused-opacity: 0.55;
  --split-tabs-focused-opacity: 1;
  --split-tabs-selected-opacity: 0.85;
}

Opacity applies to .split-tabs-pane-content and its matching .split-tabs-keep--overlay content. Custom dimming must target those wrappers, never .split-tabs-pane: pane opacity creates a stacking context that traps covers and badges beneath the overlay Keep layer. Bars remain undimmed, with their own bar-focus effect. Pane covers, badges, focus/selection borders and drop quarters likewise exclude bars. The grouping outline is clipped to selected pane rectangles even with mixed bar sides; its close button stays inside a selected pane rather than a bar.

Border and dimming together

.workspace {
  --split-tabs-focus-border: 3px solid #168b77;
  --split-tabs-focus-radius: 4px;
  --split-tabs-unfocused-opacity: 0.7;
  --split-tabs-focused-opacity: 1;
  --split-tabs-selected-border: 2px dashed #bd7d16;
  --split-tabs-selected-opacity: 0.9;
}

Choose contrast for your own light/dark themes and the content being embedded; the sample colours are host choices, not library defaults. The Workbench lets you compare all three strategies over live iframes.

Geometry and stacking

Self-drop previews distinguish existing content on the dropped half from the fresh placeholder opposite. The latter uses .split-tabs-drop-shade.split-tabs-drop-preview--new, --split-tabs-drop-new-background (default rgba(127, 127, 127, 0.08)), and --split-tabs-drop-new-shadow (default inset 0 0 0 2px currentColor). Its text is host-only labels.newPane; missing wording leaves it empty. Both halves use data-refused and the existing refusal background when minimum sizes cannot fit.

The root writes --split-tabs-divider-size and --split-tabs-side-bar-width inline from controller options. A rendered side bar also has its component-supplied --split-tabs-bar-width. Keep those names available in custom styles rather than hard-coding a competing width. A divider option below 1 px, NaN, or infinity throws at creation; its grab zone remains at least 8 px.

Top/bottom bars use barThickness as their actual height, written inline as --split-tabs-bar-thickness; left/right bars use sideBarWidth and persisted widths. If a host changes tab dimensions, update the corresponding controller options too. Raise stacking variables only with a clear layer policy: the focus mark must stay above overlay content, and drag covers must still intercept layout gestures.

CSS variable reference

This table is extracted from README.org at build time. The builder scans src/style.css and fails if any --split-tabs-* variable is undocumented, so a new style hook cannot silently disappear from this reference. Defaults below describe the library; the Workbench supplies its own theme.

Variable Default / notes
--split-tabs-color inherit
--split-tabs-background transparent
--split-tabs-pane-background transparent
--split-tabs-frame-background transparent
--split-tabs-frame-shadow inset 0 0 0 2px rgba(127, 127, 127, 0.25)
--split-tabs-focus-border 2px solid rgba(80, 140, 255, 0.9); none hides the focus border
--split-tabs-focus-radius 0
--split-tabs-focus-background transparent
--split-tabs-unfocused-opacity 1; below 1 dims every pane (and its overlay content) but the focused one
--split-tabs-focused-opacity 1
--split-tabs-selected-opacity the unfocused opacity
--split-tabs-selected-border none
--split-tabs-mark-z-index 4, above the overlay content layer
--split-tabs-overlay-z-index 4
--split-tabs-selected-background rgba(80, 140, 255, 0.14)
--split-tabs-cover-z-index 4
--split-tabs-cover-cursor grab
--split-tabs-cover-background transparent
--split-tabs-arrange-background rgba(0, 0, 0, 0.25)
--split-tabs-pane-number-z-index 5
--split-tabs-pane-number-background rgba(0, 0, 0, 0.45)
--split-tabs-pane-number-preview-background rgba(0, 0, 0, 0.25)
--split-tabs-pane-number-hover-background rgba(127, 127, 127, 0.45)
--split-tabs-pane-number-current-background rgba(0, 0, 0, 0.6)
--split-tabs-pane-number-badge-size 56px
--split-tabs-pane-number-badge-radius 8px
--split-tabs-pane-number-badge-background rgba(0, 0, 0, 0.65)
--split-tabs-pane-number-badge-color #fff
--split-tabs-pane-number-badge-font-size 32px
--split-tabs-pane-number-preview-badge-size 40px
--split-tabs-pane-number-preview-badge-radius var(--split-tabs-pane-number-badge-radius, 8px)
--split-tabs-pane-number-preview-badge-background var(--split-tabs-pane-number-badge-background, rgba(0, 0, 0, 0.65))
--split-tabs-pane-number-preview-badge-color var(--split-tabs-pane-number-badge-color, #fff)
--split-tabs-pane-number-preview-badge-font-size 24px
--split-tabs-divider-size 6px (inline controller value)
--split-tabs-divider-background transparent
--split-tabs-divider-z-index 2
--split-tabs-divider-hit-extra 4px
--split-tabs-divider-active-background currentColor
--split-tabs-keep-z-index 1
--split-tabs-keep-overflow hidden
--split-tabs-strip-scrollbar thin
--split-tabs-strip-scrollbar-size 6px
--split-tabs-strip-gap 0px
--split-tabs-strip-padding 0px
--split-tabs-strip-background transparent
--split-tabs-bar-preview-background Canvas; opaque, since the drag preview bar covers pane content
--split-tabs-strip-end-background inherit
--split-tabs-strip-end-padding 0
--split-tabs-drag-opacity 0.5
--split-tabs-button-color inherit
--split-tabs-button-background transparent
--split-tabs-button-radius 0px
--split-tabs-button-padding 0.25rem 0.5rem
--split-tabs-tab-active-background rgba(127, 127, 127, 0.12)
--split-tabs-button-hover-background rgba(127, 127, 127, 0.08)
--split-tabs-bar-focus-shadow inset 0 0 0 2px rgba(255, 200, 0, 0.6)
--split-tabs-spring-background rgba(80, 140, 255, 0.25)
--split-tabs-bar-resize-hit 6px
--split-tabs-side-bar-width 96px (inline controller value)
--split-tabs-bar-width Component-supplied width for a rendered side bar.
--split-tabs-bar-thickness 32px, set inline from controller.barThickness; actual top/bottom bar height, including padding.
--split-tabs-close-hit 18px
--split-tabs-close-gap 2px
--split-tabs-icon-visible-opacity 1
--split-tabs-close-size 10px
--split-tabs-drop-refused-background rgba(220, 60, 60, 0.25)
--split-tabs-marker-color currentColor
--split-tabs-selection-border 2px dashed rgba(60, 180, 90, 0.9)
--split-tabs-selection-snap-color rgba(230, 150, 30, 0.95)
--split-tabs-selection-refused-color rgba(220, 60, 60, 0.95)
--split-tabs-selection-moved-border 2px dotted rgba(230, 150, 30, 0.9)
--split-tabs-selection-intruder-background rgba(220, 60, 60, 0.18)
--split-tabs-selection-close-color #fff
--split-tabs-selection-close-background rgba(220, 60, 60, 0.95)
--split-tabs-destination-border 3px solid rgba(80, 140, 255, 0.9)
--split-tabs-nest-border 2px dashed rgba(170, 120, 255, 0.8)
--split-tabs-guide-color rgba(255, 200, 0, 0.9)
--split-tabs-bin-offset 12px
--split-tabs-bin-size 56px
--split-tabs-bin-radius 12px
--split-tabs-bin-z-index 6
--split-tabs-bin-color #fff
--split-tabs-bin-background rgba(0, 0, 0, 0.55)
--split-tabs-bin-hot-background rgba(220, 60, 60, 0.9)
--split-tabs-ghost-pane-width 96px
--split-tabs-ghost-pane-height 64px
--split-tabs-drop-shade-background rgba(127, 127, 127, 0.2)
--split-tabs-drop-new-background rgba(127, 127, 127, 0.08); opposite new-pane half
--split-tabs-drop-new-shadow inset 0 0 0 2px currentColor
--split-tabs-drop-label-color inherit
--split-tabs-drop-z-index 5
--split-tabs-ghost-background Canvas
--split-tabs-ghost-color CanvasText
--split-tabs-ghost-opacity 0.85
--split-tabs-ghost-shadow 0 4px 12px rgba(0, 0, 0, 0.2)
--split-tabs-ghost-z-index 10000
--split-tabs-menu-z-index 10001
--split-tabs-menu-padding 0.25rem
--split-tabs-menu-radius 0
--split-tabs-menu-color CanvasText
--split-tabs-menu-background Canvas
--split-tabs-menu-shadow 0 4px 12px rgba(0, 0, 0, 0.2)
--split-tabs-menu-item-gap 0.5rem
--split-tabs-menu-item-padding 0.5rem
--split-tabs-menu-item-radius 0
--split-tabs-menu-item-background transparent
--split-tabs-menu-item-hover-background rgba(127, 127, 127, 0.15)
--split-tabs-menu-disabled-opacity 0.5
--split-tabs-menu-icon-size 1em
--split-tabs-menu-separator-size 2px
--split-tabs-menu-separator-margin 0.25rem 0
--split-tabs-menu-separator-background rgba(127, 127, 127, 0.15)
--split-tabs-menu-reason-font-size 0.85em
--split-tabs-menu-reason-color inherit