Skip to content

GhostToolbar ​

GhostToolbar groups related controls into a single role="toolbar" container with roving tabindex and arrow-key movement. Import it from @ghostvue/vue for headless use, or from @ghostvue/themes for a default flex layout.

Document formatting toolbar ​

Document formatting toolbar

Themed toolbar with grouped formatting controls, vertical separator, and roving focus.

Document toolbarNo formatting action applied yet

A single Tab stop enters the GhostToolbar and arrow keys move focus across formatting and clear actions, separated by a semantic vertical GhostSeparator.

API ​

PropTypeDefaultDescription
asGhostToolbarElement"div"Root element tag for the toolbar container.
dirGhostToolbarDirection—Optional text direction for horizontal arrow reversal in RTL.
labelstring—Accessible name via aria-label when a visible label element is not used.
loopbooleantrueWrap arrow and Home/End movement from last enabled item to first.
orientationGhostToolbarOrientation"horizontal"Toolbar layout and roving arrow axis. Sets aria-orientation when vertical.
SlotSlot propsDescription
default—Toolbar items such as GhostButton, GhostSwitch, and GhostSeparator.

@ghostvue/themes adds no props, events, or slots to the headless GhostToolbar API, which it forwards.

Native attributes and listeners fall through to the root. There is no v-model. defineExpose provides element, focus(), and blur() on the toolbar root.

Vertical layout ​

Themed

Flex layout from @ghostvue/themes.

No annotation added

Use orientation="vertical" for a column of tools. In the annotation example, ArrowDown focuses Highlight and Enter applies it. Clear belongs to a separate group and the horizontal separator is skipped by arrow keys.

Separators ​

Use a vertical separator in a horizontal toolbar and a horizontal separator in a vertical toolbar. Set :decorative="false" when the separator marks a meaningful grouping, as in the document formatting and annotation examples.

Themed use ​

The themed wrapper adds flex row/column layout under .ghost-theme or .ghost-themed-scope. See the default theme guide.

Advanced: headless composition ​

Basic use ​

Basic Headless

Horizontal action bar with roving focus among buttons.

The default slot accepts focusable controls such as GhostButton and GhostSwitch. Arrow keys skip disabled items. The following examples show a custom vertical layout and separators with consumer CSS.

Vertical Headless

Vertical toolbar with up and down arrow movement.

Separators Headless

Group controls with semantic vertical separators.

To attach the same roving focus behavior to a native host, pass a template ref as element to the composable.

Composable Headless

Same contract as GhostToolbar on a native host.

Styling ​

The unstyled root uses class ghost-toolbar, data-part="root", data-ghost-toolbar, and data-orientation. Recipe CSS targets flex direction from data-orientation.

Accessibility ​

Follow the WAI-ARIA APG Toolbar pattern. Name the bar with label or aria-labelledby. Tab enters the group at the current roving item; arrow keys move among enabled controls; Tab moves focus out of the group.