GhostSegmentedControl reference
Package: @ghostvue/vue. Status: experimental (stability policy).
Headless single-select segmented control with sliding indicator CSS variables and toggle-group roving focus.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
as | GhostSegmentedControlElement | "div" | No | Root host element. |
defaultValue | GhostSegmentedControlValue | — | No | Initial selection when `modelValue` is omitted. |
deselectable | boolean | false | No | When false, pressing the active segment keeps it selected (default view switching). |
dir | 'ltr' | 'rtl' | — | No | Explicit text direction for horizontal roving. |
disabled | boolean | false | No | Disables every item. |
modelValue | GhostSegmentedControlValue | — | No | Controlled selection. |
orientation | 'horizontal' | 'vertical' | "horizontal" | No | Arrow-key roving layout and indicator slide axis. |
Emits
None declared.
Models
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | GhostSegmentedControlValue | v-model binding for `modelValue`. |
Slots
| Name | Description |
|---|---|
default | Segment items. |
Slot props: default
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
blur | () => void | Exposed method `blur`. |
element | HTMLElement | null | Exposed property `element`. |
focus | (options?: FocusOptions) => void | Exposed method `focus`. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Group host with indicator CSS variables. |
data-part | indicator | Decorative sliding thumb; aria-hidden. |
data-state | disabled | Group-level disabled via aria-disabled. |
CSS variables
| Name | Description |
|---|---|
--ghost-segmented-item-count | Registered item count for indicator geometry. |
--ghost-segmented-selected-index | Zero-based index of the pressed item. |
Accessibility
Role: group. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/button/.
Required ARIA attributes: aria-label, aria-labelledby.
Keyboard
| Key | Action | Automated browser test |
|---|---|---|
ArrowLeft | Previous enabled item (horizontal). | Not reviewed |
ArrowRight | Next enabled item (horizontal). | Not reviewed |
ArrowUp | Previous enabled item (vertical). | Not reviewed |
ArrowDown | Next enabled item (vertical). | Not reviewed |
Home | First enabled item. | Not reviewed |
End | Last enabled item. | Not reviewed |
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
segmented-control/basic
Segmented control Headless
Single-select view switcher with sliding indicator vars.
segmented-control/themed
Segmented control themed
Token-driven thumb with reduced-motion support.