Skip to content

Link

Link

Navigation component for creating accessible hyperlinks with various styles.

Import

import { Link } from '@primitivekit/vanilla';

Basic Usage

const link = new Link({ /* options */ });
document.body.appendChild(link.element);

Props

No props available.

Customization

The Link component supports CSS variables for complete customization:

const link = new Link({
  style: {
    '--link-bg-color': '#007bff',
    '--link-text-color': '#ffffff'
  }
});

Design Tokens

The following design tokens are available for customization:

  • --link-color
  • --link-color-hover
  • --link-color-active
  • --link-color-visited
  • --link-color-focus
  • --link-bg-color
  • --link-bg-color-hover
  • --link-bg-color-active
  • --link-bg-color-focus
  • --link-font-family
  • … and 89 more

Accessibility

The Link component is fully accessible and follows WCAG 2.1 AA standards:

  • ✅ Semantic HTML elements
  • ✅ Keyboard accessible
  • ✅ Focus visible indicator
  • ✅ Proper ARIA attributes
  • ✅ Screen reader compatible
  • ✅ Touch target size (44x44px minimum)
  • ✅ Color contrast compliance

Keyboard Navigation

KeyAction
TabMove focus to/from component
EnterActivate component
SpaceActivate component

Related Components

  • Breadcrumb - Navigation component for showing the current page location in a hierarchical structure.
  • Tabs - Navigation component for organizing content into multiple panels with tab selection.
  • Menu - Navigation component for displaying a list of actions or navigation links.
  • Steps - Navigation component for showing progress through a multi-step process or wizard.
  • Pagination - Navigation component for splitting content across multiple pages with page controls.

See Also