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.
<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
| Element | Description |
|---|---|
| Label | The visible text of the link. |
| Right icon | Icon placed after the label to indicate an action affordance. |
| Left icon | Icon placed before the label to represent meaning. |
Best practices #
| Guidance | Practice |
|---|---|
| Recommended | Use link text that describes the destination, e.g. "View docs" or "Contact us". Avoid "click here". |
| Recommended | Use isExternalLink for off-site links to add target="_blank" and rel="noopener noreferrer". |
| Recommended | Use color="secondary" to reduce visual weight in groups of links or paragraphs. |
| Recommended | Put 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't | Make every piece of text a link; it weakens link discoverability. |
| Don't | Expect 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't | Make a critical action only a link. Important actions should use Button. |
Examples #
Link — External links
A vertical list of external links that open in a new tab with an indicator icon.
Link — Inline text
A link embedded within a paragraph of body text.
Horizontal row of standalone links with descriptive hover tooltips.
Link — Line limit
In a narrow box the link shows at most two lines, in a smaller size and a heavier weight.