Skip to main content

Link

Link is a styled anchor element with variants for different use cases.

Open in Storybook

Import

import { Link } from "@tosui/react";

Basic Usage

Variants

Use external for links that open in a new tab. This automatically adds target="_blank" and rel="noopener noreferrer".

Read our documentation for more information, or check out the getting started guide.

With Router Libraries

Link is polymorphic and works with router libraries like React Router or Next.js.

// React Router
import { Link as RouterLink } from "react-router-dom";

<Link as={RouterLink} to="/about">
About
</Link>

// Next.js
import NextLink from "next/link";

<Link as={NextLink} href="/about">
About
</Link>

Props Reference

PropTypeDefaultDescription
variant"default" | "underline" | "subtle""default"Visual variant
externalbooleanfalseOpen in new tab
hrefstring-Link destination
asElementType"a"HTML element or router component

Link also accepts all Box styling props.

TypeScript

import { Link, type LinkVariant, type LinkProps, type LinkOwnProps } from "@tosui/react";