Skip to content

Link

  • Going to another page or another site
  • Jumping to a section of the page
  • Downloading a file

Not for actions that change something on the page — use a Button.

Choosing between actions and navigation:

ComponentUse it forFor example
ButtonDoes something on this page: saves, deletes, opens a dialog“Save”, “Delete”, “Add to cart”
LinkGoes somewhere: another page, a section, a file“View invoice”, “Read the docs”
ToggleTurns a state on or off and stays pressed“Bold”, “Mute”

Choosing between moving around:

ComponentUse it forFor example
BreadcrumbShowing where the page sits in a hierarchy, with links up itHome / Projects / Website
PaginationMoving between pages of one long listSearch results, page 3 of 12
TabsSwitching between views within one pageOverview / Activity / Settings
LinkOne destination“Read the docs”

Read the installation guide, then pick a brand in Theming and brands. Sources are on GitHub (opens in a new tab).

import { Link } from '@arun-dev/ui';
import { docsUrl } from '@/lib/url';
export default function LinkBasics() {
return (
<p style={{ margin: 0, maxInlineSize: '32rem' }}>
{/* docsUrl adds the site's base path, as a router's link would. */}
Read the <Link href={docsUrl('/getting-started/installation/')}>installation guide</Link>,
then pick a brand in{' '}
<Link href={docsUrl('/getting-started/theming/')}>Theming and brands</Link>. Sources are on{' '}
<Link href="https://github.com/arun9483/arun-design-system" target="_blank" rel="noreferrer">
GitHub (opens in a new tab)
</Link>
.
</p>
);
}

Link is always an <a href>, so focus, Enter, “open in new tab” and the back button are the browser’s. Use it to go somewhere. To do something, such as save or delete, use a Button.

Pass your router’s link through render. The styling stays, and the router handles the click:

import NextLink from 'next/link';
<Link render={<NextLink href="/docs" />}>Docs</Link>;
Link props
PropTypeDefaultDescription
classNamestringConcatenated with the component's own classes, never replacing them.
renderReactElementElement or component to render instead of the default. Props, className, event handlers and ref are merged onto it.
refRef<HTMLElement>Ref to the rendered element. Merged with any ref on the render element.
…restHTMLAttributesAnything else is spread onto the rendered element, so id, aria-*, data-* and event handlers all reach the DOM.
  • There is no disabled: it has no meaning on a link. Render plain text instead.
  • Opening in a new tab is your choice, per link: add target="_blank" and rel="noreferrer", and say so in the text.
  • A link to a page already visited takes --link-color-visited, as a native link does: the accent pulled toward the text colour, so it stays readable for any brand. Only colours can change on :visited; the browser ignores anything else there, for privacy. Breadcrumb, Pagination and link cards don’t mark visited pages — they navigate, where every page is one you have seen.
  • Restyle with --link-color, --link-color-hover, --link-color-visited and --link-underline-*.