Skip to content

GhostSeparator ​

GhostSeparator is a visual and semantic divider for menus, toolbars, and layouts. Import it from @ghostvue/themes for the default hairline treatment. To draw your own rules, see Advanced: headless composition.

Release metadata and action groups ​

Release metadata and action groups

Horizontal section rule paired with vertical inline metadata and action-group separators.

@ghostvue/themes Stable
v2.14.0
MIT License
Updated 2h ago

The release header uses three themed GhostSeparator rules from @ghostvue/themes, and each one makes a different choice:

  • Between version, license and update time: orientation="vertical" with decorative. The rules are only visual, so assistive technology reads the three values as one line of metadata.
  • Between the header and the actions: the default horizontal rule, a native <hr> that keeps separator semantics because the header and the actions are separate sections.
  • Between the action groups: a semantic vertical separator (role="separator", aria-orientation="vertical"), so assistive technology hears the review actions and the promote action as separate sets.

Basic use ​

The default is a native <hr>: implicit role="separator", horizontal orientation, and no extra ARIA. It is empty; the component has no content slot because native hr cannot have children and separator descendants would be presentational.

Vertical grouping ​

Vertical rules have no native element, so the default host is a div with role="separator" and aria-orientation="vertical". Place them in a stretching flex or grid row so they have a block size:

Themed

Hairline rules on the @ghostvue/themes wrapper.

Inside a GhostToolbar, the same rules group the toolbar's buttons and the toolbar provides arrow-key focus.

Decorative lines ​

When the line is only visual and does not group anything for assistive technology, set decorative, as the release header's metadata row does. The element stays in the layout but has role="none" and no aria-orientation, so it is not a separator in the accessibility tree.

Do not mark menu or toolbar grouping separators decorative. Those need role="separator" so grouped items are announced as separate sets.

Lists and menus ​

Themed menus such as GhostDropdownMenu ship their own separator part. To build a list-shaped menu yourself, see the headless list separator.

Themed use ​

Importing the themed component loads the default stylesheet. There are no extra visual props; color is --ghost-border-default and thickness is --ghost-border-hairline-width.

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

Accessibility and environment behavior ​

Semantic horizontal hr uses native separator semantics. Other semantic hosts set role="separator"; vertical ones also set aria-orientation="vertical". Decorative instances set role="none" and omit aria-orientation. The component is not focusable and adds no keyboard behavior. Window splitters (focusable, resizable) are out of scope.

SSR markup is deterministic from props. Setup does not read browser globals.

See the GhostSeparator specification for the complete behavior and compatibility contract.

Advanced: headless composition ​

For teams that bring their own design system, the headless GhostSeparator from @ghostvue/vue sets the same roles and orientation with no visuals. The examples below draw the line only where they bring their own CSS.

Headless horizontal rule ​

Basic Headless

Native horizontal thematic break with separator semantics.

Profile


Billing

Headless vertical rule ​

Vertical Headless

Inline-axis rule between neighboring items.

CutCopy

Headless decorative rule ​

Decorative Headless

Visual line omitted from the accessibility tree.

The line below is visual only.


Assistive technology reads these paragraphs as contiguous.

Headless list separator ​

Inside a list-shaped menu, render the separator as an li. The parent should use role="menu" so the li is a grouping separator rather than a broken list item:

List Headless

li separator inside a list-shaped menu.

  • New
  • Open
  • Quit

Composable ​

useGhostSeparator returns as and rootProps for a host you render yourself. The GhostSeparator reference page renders the separator/composable example with its source.

Styling ​

The unstyled component renders one element with class ghost-separator, data-part="root", and data-orientation="horizontal" or data-orientation="vertical". There is no data-state and no internal wrapper to target.

css
.ghost-separator[data-orientation='vertical'] {
  /* Applies only to vertical rules. */
}

You can also import the stylesheet and wrap unstyled separators in .ghost-theme when you want a region of headless components to pick up the defaults. See the default theme guide.

API ​

PropTypeDefaultDescription
asGhostSeparatorElement—Rendered root element. Omit to get hr when horizontal and div when vertical. li is valid inside a list-shaped menu (role=menu).
decorativebooleanfalseWhen true, sets role=none so the line is omitted from the accessibility tree. Defaults false so native hr and menu/toolbar grouping keep separator semantics.
orientationGhostSeparatorOrientation"horizontal"Axis of the line. Vertical has no native element, so the default as becomes div.

Native attributes fall through to the single root. The component owns role and aria-orientation; pass id, class, data-*, or aria-label as ordinary attributes when you need them. There is no v-model and no exposed ref contract.