HomeDocsBlogGithub
Docs/Reference/Link

Link

The <Link> component is used to navigate between pages in your app.

Usage

Links can be rendered by both server and client components.

// app/pages/index.page.tsx

import Link from "@twofold/framework/link";

export default function IndexPage() {
  return (
    <div>
      <h1>Home</h1>
      <Link href="/about">About</Link>
    </div>
  );
}

Just like the <a> tag, the <Link> component accepts an href prop that specifies the URL to navigate to.

Props

There are a handful of props that can be passed to the <Link> component to customize its behavior.

PropTypeDescription
hrefstringThe URL of the page to navigate to.
replacebooleanDefault false. If true, the current page will be replaced in the history stack instead of pushing a new entry.
scroll'top' | 'preserve'Default top. When preserve the the page will not scroll to the top after navigation.
maskstringWhen set this path will be used in the browser's location bar.
asElementTypeDefault a. The element to render.
childrenReactNodeThe content of the link.