Skip to content

GhostButton reference ​

Package: @ghostvue/themes. Status: experimental (stability policy).

Themed wrapper around headless GhostButton. Same behavioral props plus variant, tone, size, block, and iconOnly. Importing it loads the default stylesheet and scopes styles to this instance. Hand-written until GHO-13 generates manifests.

Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.

All component references

Props ​

NameTypeDefaultRequiredDescription
type'button' | 'submit' | 'reset'"button"NoNative button behavior, forwarded to the unstyled GhostButton.
disabledbooleanfalseNoForwards native disabled semantics to the unstyled GhostButton.
loadingbooleanfalseNoForwards consumer-owned pending state to the unstyled GhostButton.
variant'solid' | 'soft' | 'outline' | 'ghost'"solid"NoVisual treatment. The default omits data-variant so CSS can treat a missing hook as solid.
tone'accent' | 'neutral' | 'danger'"accent"NoSemantic color intent, independent of variant. The default omits data-tone.
size'sm' | 'md' | 'lg'"md"NoControl size. The default omits data-size so CSS can treat a missing hook as md.
blockbooleanfalseNoStretch to the available inline size via data-block.
iconOnlybooleanfalseNoSquare icon-button treatment via data-icon-only. Still requires an accessible name.
interactive'spotlight'—NoOpt-in pointer spotlight. Off by default. Sets data-interactive and tracks on data-interactive-state so loading/disabled keep data-state.

Emits ​

None declared.

Models ​

None declared.

Slots ​

NameDescription
defaultButton label and optional decorative content such as an icon. Icon-only use requires aria-label, aria-labelledby, or hidden text.

Slot props: default ​

None declared.

Exposed members ​

NameTypeDescription
elementHTMLButtonElement | nullThe native button after mount; null before mount and after unmount. Delegates to the unstyled GhostButton.
focus(options?: FocusOptions) => voidFocuses the native button when it is mounted and enabled. Delegates to the unstyled GhostButton.
blur() => voidRemoves focus from the native button when it is mounted. Delegates to the unstyled GhostButton.

Parts and data attributes ​

AttributeValueDescription
data-partrootThe native button element inside the display:contents themed scope.
data-particonOptional decorative icon content inside the default slot.
data-partloading-indicatorOptional decorative pending indicator. Replaces the default spinner when present.
data-partglowDecorative spotlight overlay rendered when interactive is spotlight. aria-hidden.
data-stateloadingPending action. Overlay spinner and wait cursor. Wins over disabled for data-state.
data-statedisabledUnavailable appearance. Prefer the native disabled attribute when both apply.
data-variantsoft, outline, ghostVisual treatment on the root button. Absent for the default solid variant.
data-toneneutral, dangerSemantic color intent on the root button. Absent for the default accent tone.
data-sizesm, lgControl size on the root button. Absent for the default md size.
data-blockpresentPresent on the root button when block is true.
data-icon-onlypresentPresent on the root button when iconOnly is true.
data-interactivespotlightPresent on the root button when interactive is spotlight.
data-interactive-stateoff, idle, trackingSpotlight pointer state on the root button: off while reduced motion or a coarse pointer disables the effect, idle while opted in and at rest, tracking while the pointer is over the button. Kept separate from data-state so loading and disabled stay stylable.

CSS variables ​

NameDescription
--ghost-surface-bgCanvas background on .ghost-theme and the mix surface for soft, outline, and ghost treatments.
--ghost-surface-fgCanvas foreground on .ghost-theme.
--ghost-action-primary-bgSolid background fallback and outline/ghost foreground for the accent tone.
--ghost-action-primary-fgContent color on the solid accent treatment.
--ghost-action-primary-borderBorder color on the solid accent treatment.
--ghost-action-primary-gradient-fromAccent solid gradient start. Contrast-gated against accent foreground.
--ghost-action-primary-gradient-toAccent solid gradient end. Contrast-gated against accent foreground.
--ghost-action-neutral-bgSolid background fallback and outline/ghost foreground for the neutral tone.
--ghost-action-neutral-fgContent color on the solid neutral treatment.
--ghost-action-neutral-borderBorder color on the solid neutral treatment.
--ghost-action-danger-bgSolid background fallback and outline/ghost foreground for the danger tone.
--ghost-action-danger-fgContent color on the solid danger treatment.
--ghost-action-danger-borderBorder color on the solid danger treatment.
--ghost-action-disabled-bgDesaturated unavailable background. Used instead of fading the rest tone.
--ghost-action-disabled-fgUnavailable foreground. Reduced emphasis, still legible.
--ghost-action-disabled-borderUnavailable border.
--ghost-action-disabled-opacityShared unavailable-state opacity. GhostButton uses dedicated disabled colors instead.
--ghost-gradient-action-primaryOklch gradient fill for solid accent actions.
--ghost-gradient-action-neutralOklch gradient fill for solid neutral actions.
--ghost-gradient-action-dangerOklch gradient fill for solid danger actions.
--ghost-state-layer-hoverHover overlay opacity on the current tone.
--ghost-state-layer-pressPressed overlay opacity on the current tone.
--ghost-state-layer-selectedSelected overlay opacity, used when aria-pressed is true.
--ghost-state-layer-draggedDragged overlay opacity, used when aria-grabbed is true.
--ghost-motion-press-scalePressed scale. 1 under reduced motion.
--ghost-focus-ring-durationFocus-ring entrance duration. Instant under reduced motion.
--ghost-action-durationDuration of color and opacity transitions.
--ghost-action-gapSpace between label and icon content.
--ghost-action-icon-sizeSize of content marked data-part=icon.
--ghost-action-label-weightButton label font weight.
--ghost-action-radiusCorner radius of the themed button.
--ghost-action-spinner-sizeSize of the default and custom loading indicators.
--ghost-action-spinner-widthStroke width of the default loading spinner.
--ghost-focus-ring-colorOuter color of the two-color keyboard focus indicator.
--ghost-focus-ring-contrastInner color of the two-color keyboard focus indicator.
--ghost-focus-ring-offsetGap between the button edge and the focus ring.
--ghost-focus-ring-widthThickness of the focus outline.
--ghost-control-size-sm-minMinimum block size for size sm.
--ghost-control-size-sm-padding-blockBlock padding for size sm.
--ghost-control-size-sm-padding-inlineInline padding for size sm.
--ghost-control-size-md-minMinimum block size for size md.
--ghost-control-size-md-padding-blockBlock padding for size md.
--ghost-control-size-md-padding-inlineInline padding for size md.
--ghost-control-size-lg-minMinimum block size for size lg.
--ghost-control-size-lg-padding-blockBlock padding for size lg.
--ghost-control-size-lg-padding-inlineInline padding for size lg.

Accessibility ​

Role: button. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/button/.

Required ARIA attributes: none.

Keyboard ​

KeyActionAutomated browser test
EnterActivate the button when it is enabled and not loading.Not reviewed
SpaceActivate the button when it is enabled and not loading.Not reviewed

Verification ​

Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.

CategoryStatusEvidence
Automated keyboardNot reviewedNo declared key is mapped to a browser test yet.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

button/action-bar ​

Example source

Publish action bar

Primary, secondary, and destructive actions with a pending publish.

Quarterly product updateDraft saved at 10:42

button/refresh-status ​

Example source

Refresh with a failed attempt

A keyboard-triggered refresh keeps focus while pending and after a failure, then succeeds on retry.

Production deploymentsLast checked 5 minutes ago.

button/configured ​

Example source

Configured action

Typed visual props and a loading state the application owns.

button/themed ​

Example source

Themed

Visual props on the @ghostvue/themes wrapper.

button/loading ​

Example source

Loading and disabled

Pending actions keep their width and focus; disabled ones do not.

button/marked-parts ​

Example source

Marked slot parts

Icons and a custom loading indicator using data-part in the default slot.

button/icon-only ​

Example source

Icon only

Square treatment with an accessible name from aria-label.