Link
Anchor primitive with token-driven styling, underline behaviour, and safe defaults for external destinations.
Renders a native <a>; external adds rel="noopener noreferrer" and target="_blank" plus an aria-hidden indicator icon so screen readers aren't double-announced.
import { Link } from '@arshad-shah/cynosure-react';
export default function Example() {
return <Link href="/docs">Read the documentation</Link>;
}
Variants
Section titled “Variants”Three visual variants tune emphasis without changing semantics: default, subtle (for muted body links), and emphasis (for hero or callout links).
import { Link } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1rem' }}>
<Link href="/docs" variant="default">
Default link
</Link>
<Link href="/docs" variant="subtle">
Subtle link
</Link>
<Link href="/docs" variant="emphasis">
Emphasised link
</Link>
</div>
);
}
Underline
Section titled “Underline”underline controls underline behaviour — hover (default), always, or none. Pick the option that matches how prominent the link should look in flow.
import { Link } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1rem' }}>
<Link href="/docs" underline="hover">
Underline on hover
</Link>
<Link href="/docs" underline="always">
Always underlined
</Link>
<Link href="/docs" underline="none">
No underline
</Link>
</div>
);
}
External
Section titled “External”Pass external to automatically set target="_blank", append rel="noopener noreferrer", and render a decorative indicator icon. Caller-provided rel and target merge cleanly with the safe defaults.
import { Link } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Link href="https://github.com/arshad-shah/cynosure" external>
View Cynosure on GitHub
</Link>
);
}
Inline usage
Section titled “Inline usage”Drop a Link inside a Text to keep paragraph flow while remaining keyboard accessible.
import { Link, Text } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Text>
Read the <Link href="/docs">getting started guide</Link> to pick up the basics, then explore
the <Link href="/components">component catalogue</Link>.
</Text>
);
}
Disabled
Section titled “Disabled”disabled cancels navigation, sets aria-disabled, and applies the muted style — use sparingly since disabled links are easy to miss.
import { Link } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Link href="/docs" disabled>
Unavailable link
</Link>
);
}
Accessibility
Section titled “Accessibility”- Always write link text that stands on its own — avoid bare “click here” or “read more” copy.
externaladdsrel="noopener noreferrer"automatically sotarget="_blank"never leakswindow.opener.- The external indicator icon is
aria-hidden; the link text alone carries meaning for screen readers. disabledsetsaria-disabled="true"and blocks the click handler, but the anchor remains in the tab order — prefer hiding or replacing the link when it has no destination.- Underline + colour together carry the link signal so colour-blind users aren’t dependent on hue alone.
Recipes
Section titled “Recipes”- Use
underline="always"for body links that must stand out against long-form prose. - Drop
Link asChildover a framework router link to inherit Cynosure styling without losing client-side navigation:<Link asChild><NextLink href="/next">Next</NextLink></Link>. - Combine
variant="subtle"with breadcrumbs or footer rows where many links sit close together. - Pair
externalwith descriptive copy (“View on GitHub”) so the destination is obvious before the click.