Link

Alignment target:@astryxdesign/core v0.7.1 · Link

Usage #

Link navigates inside the app or out of it. With href it renders an anchor. Pass as to use a router link or another component; that component receives both href and to. Without href it renders a button. A disabled link stays a plain anchor and does not use the custom root. size and weight follow the same steps as body text, and maxLines limits how many lines stay visible.

Import the component from its dedicated entry. Structural styles are loaded automatically.

Vue
<script setup lang="ts">
import { Link } from '@astryx-vue/core/Link'
</script>

<template>
  <Link href="/docs">
    Documentation
  </Link>
  <Link href="https://github.com" is-external-link>
    GitHub
  </Link>
</template>

Anatomy

ElementDescription
LabelThe visible text of the link.
Right iconIcon placed after the label to indicate an action affordance.
Left iconIcon placed before the label to represent meaning.

Best practices #

GuidancePractice
RecommendedUse link text that describes the destination, e.g. "View docs" or "Contact us". Avoid "click here".
RecommendedUse isExternalLink for off-site links to add target="_blank" and rel="noopener noreferrer".
RecommendedUse color="secondary" to reduce visual weight in groups of links or paragraphs.
RecommendedPut a Link inside a Text with maxLines to truncate it with the surrounding text; inside a clamped Text the link flows in the text's lines.
Don'tMake every piece of text a link; it weakens link discoverability.
Don'tExpect a clamped Text to cut a Link that sets its own maxLines or renders as a button (no href); that Link keeps its own box.
Don'tMake a critical action only a link. Important actions should use Button.

Examples #

Open in Playground

A vertical list of external links that open in a new tab with an indicator icon.

Link — Inline text

Open in Playground

A link embedded within a paragraph of body text.

Link — With tooltips

Open in Playground

Horizontal row of standalone links with descriptive hover tooltips.

Open in Playground

In a narrow box the link shows at most two lines, in a smaller size and a heavier weight.