Link

From thedaviddias/ux-patterns-for-developers · View interactive version

Link is an AI agent skill from the GitHub repository thedaviddias/ux-patterns-for-developers. Use when you need to create accessible and interactive links.

How to use this skill

Skill file

Link

Create accessible and interactive links

What it solves

Links are the fundamental building blocks of web navigation, connecting pages, resources, and actions through clickable text or elements. They are the most basic and ubiquitous interactive pattern on the web.

Getting links right means choosing between <a> and <button>, styling clear interactive states, ensuring color contrast, and providing context about where the link leads — especially for external destinations, downloads, and new-tab behavior.

When to use

Use Links to navigate users to another page, resource, or section within the current page.

Common scenarios include:

When to avoid

Implementation workflow

  1. Confirm the pattern matches the problem and constraints before copying the example.
  2. Start from the anatomy and examples in references/pattern.md, then choose the smallest viable variation.
  3. Apply accessibility, performance, and interaction guardrails before layering visual polish.
  4. Use the testing guidance to verify behavior across keyboard, screen reader, responsive, and failure scenarios.

Accessibility guardrails

Do's ✅

Don'ts ❌

Performance guardrails

Target Metrics

Optimization Strategies

Prefetching for Internal Links

<link rel="prefetch" href="/pricing" />
<!-- Or use framework-specific prefetch on hover -->

Common mistakes

Using "Click Here" as Link Text

The Problem:

Screen readers can list all links on a page. Multiple "click here" links are meaningless out of context.

How to Fix It:

Write descriptive link text. Instead of "Click here to view pricing", write "View pricing plans".

Using a Link When a Button Is Needed

The Problem:

A link with href="#" or javascript:void(0) that triggers a JavaScript action instead of navigating. Breaks expected browser behavior.

How to Fix It:

Use <button> for in-page actions. Use <a> only when there is a real URL destination.

Missing New-Tab Warning

The Problem:

Links with target="_blank" open in a new tab without warning, disorienting users — especially screen reader users.

How to Fix It:

Add visible text like "(opens in new tab)" or use aria-label to include the warning: aria-label="W3C guidelines (opens in new tab)".

Related patterns


For full implementation detail, examples, and testing notes, see references/pattern.md.

Pattern page: https://uxpatterns.dev/patterns/navigation/link

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.