Link
import { Link } from "@cherry-design-system/react";
export function DocsLink() {
return <Link href="/docs">Read the docs</Link>;
}A text link for navigation inside prose and UI copy. The underline sweeps in on hover, the external arrow nudges toward its target, and focus draws a ring offset from the text. Use Button for actions that do not navigate.
Link ships no client JavaScript, so it renders in React Server Components.
Examples
Muted
muted stays gray until hovered, which suits footers and secondary links.
import { Link } from "@cherry-design-system/react";
export function FooterLink() {
return (
<Link href="/privacy" variant="muted">
Privacy policy
</Link>
);
}External
external opens a new tab with rel="noopener noreferrer", shows an arrow icon and adds visually hidden text for screen readers.
import { Link } from "@cherry-design-system/react";
export function ExternalLink() {
return (
<Link href="https://example.com" external externalLabel="(opens in a new tab)">
Example site
</Link>
);
}With a router link
Link renders a plain <a>. To give a framework link the same look, add className="cherry-link" and data-variant.
import NextLink from "next/link";
export function RouterLink() {
return (
<NextLink href="/settings" className="cherry-link" data-variant="default">
Settings
</NextLink>
);
}Properties
default: underlined text color; muted: gray until hovered. Defaults to "default".
Opens in a new tab (rel="noopener noreferrer") and shows an arrow icon. An explicit target or rel wins.
Spoken after the text of an external link. Defaults to "(opens in a new tab)".
Renders an <a> and forwards its ref to it. All native <a> attributes pass through.
Styling
Root class cherry-link with data-variant (default, muted). External links get data-external and the part cherry-link__icon. States: :hover, :focus-visible.
Reads --cherry-fg-default, --cherry-fg-muted, --cherry-accent-fg and --cherry-border-focus for the focus ring.
Accessibility
Underlined so it is not identified by color alone. external opens a new tab and appends externalLabel to the accessible name, so translate it for other languages.