Link

Navigates to another page, resource, or location in the current page.

On this page

This docs is LLM-friendly and available as clean Markdown.

Supported browser agents can also use WebMCP to search, read, and open these docs. Learn more

Usage

import { GlLink } from "gitlab-ui-react/link";
<GlLink href="#documentation">Read the documentation</GlLink>

Default

Use a link for navigation. Use a button when the interaction changes data or performs an action without navigating.

Default link

Variants

Use inline inside prose, meta for secondary metadata, and mention variants for user references. The unstyled variant removes the component’s visual treatment and should be used only when another component supplies complete link styling.

Link variants

When an external destination must open in a new tab, combine target="_blank" with showExternalIcon so the behavior is visible before activation.

External link

Accessibility

  • Write link text that describes the destination without relying on nearby content.
  • Avoid disabled links when the destination can instead be omitted or explained.
  • Use target="_blank" only when opening a new tab is necessary. Set showExternalIcon for eligible external links so the behavior is visible.
  • GlLink sanitizes URL protocols by default and adds noopener noreferrer to _blank links.

API

GlLink forwards supported anchor attributes and supports Base UI’s render prop for router-link composition.

Prop Description Default
href Sets the destination. "#"
variant Sets inline, meta, mention, mentionCurrent, or unstyled styling; omit it for the default presentation. Omitted
active Applies the active visual state. false
disabled Prevents navigation and removes the link from the tab sequence. false
showExternalIcon Shows an external-link indicator for eligible _blank URLs. false
isUnsafeLink Skips URL protocol validation for a trusted URL. false
render Composes the link with a router element that ultimately renders an anchor.