Skip to content
Kappa
Link
@dicehub/kappav0.4.2

Link

A semantic anchor for inline navigation, external destinations, and framework-router composition.

Installation

Link is part of the main Kappa package. Native anchor behavior owns navigation and the Ark UI factory supplies attribute merging for framework composition.

Barrel

import { Link } from "@dicehub/kappa";

Granular

import { Link } from "@dicehub/kappa/components/link";

Usage

Use Link when activation changes location. Use Button for an action and LinkButton when navigation needs button geometry. Link text must describe the destination.

Composition

Typical part hierarchy
Link <a>
├── link text
└── Link.ExternalIcon (optional)

Link asChild (alternative)
└── RouterLink / framework link

Anchors navigate, while buttons perform actions. TheArk UI composition guidedefines the single-child asChild contract.

Examples

Variants

Use inline in prose, current in colored contexts, and plain where layout already identifies navigation.

Inline in Paragraph

An inline link follows the surrounding type scale, line height, and sentence flow.

The external prop supplies safe new-context defaults. LinkExternalIcon is Kappa's built-in decorative indicator; Link.ExternalIcon is the equivalent compound form.

Current Color

The current variant inherits its surrounding semantic color without losing the underline cue.

Use asChild with one router component. The child owns its destination and Kappa merges styling and attributes onto it.

Current Page

Keep native aria-current on the active destination so the state is available beyond color.

Right to Left

Logical spacing keeps text and inline content ordered by the inherited writing direction.

Accessibility

  • Use Link only for navigation. Use Button for commands, toggles, and form submission.
  • Write destination-specific text. Do not use vague text such as “click here.”
  • Do not simulate a disabled anchor. Remove it, omit its destination, or use the correct control.
  • Use aria-current="page" for the current destination in a navigation group.
  • Tell users when a link opens a new context. The external icon is decorative, not an accessible name.
  • Keep one element inside asChild, and ensure that it renders a semantic link.

API Reference

Renders one anchor by default and forwards native attributes and listeners.

PropTypeDefaultDescription
hrefstring—Sets the native anchor destination. The child owns navigation with asChild.
variant"inline" | "current" | "plain""inline"Selects an underlined accent, inherited underlined, or plain treatment.
externalbooleanfalseDefaults target to _blank and merges noopener noreferrer into rel.
asChildbooleanfalseMerges Link attributes and styling onto one child, such as RouterLink.
native anchor attributesAnchorHTMLAttributes—Forwards aria-*, download, hreflang, ping, referrerpolicy, rel, target, and listeners.

Slots

SlotDescription
defaultDescriptive link text and optional inline content such as Link.ExternalIcon.

Data Attributes

AttributeValueDescription
data-slot"link"Identifies the rendered link root.
data-variant"inline" | "current" | "plain"Exposes the resolved visual treatment.
data-externalpresentPresent when external is true.

Exports

ExportDescription
LinkArk factory anchor with Link.ExternalIcon composition.
LinkRootStandalone root component used by the compound Link export.
LinkExternalIconNamed decorative external-link indicator export.
LinkProps / LinkSlots / LinkVariantPublic Vue and variant contracts.
LINK_VARIANTS / LINK_DEFAULT_VARIANTSupported variants and default.
isLinkVariant / resolveLinkVariantGuard and safe variant resolver.
resolveLinkTarget / resolveLinkRelSafe external navigation helpers.