Skip to main content
The Link component provides a styled hyperlink for navigation. It supports different variants, colors, and can include icons.

Basic Usage

import { Link } from 'reshaped';

function App() {
  return (
    <Link href="/about">
      Learn more
    </Link>
  );
}

Variants

Link supports two visual variants:
<Link variant="underline" href="/about">
  Underlined Link
</Link>
<Link variant="plain" href="/about">
  Plain Link
</Link>

Colors

Link can be displayed in multiple colors:
<Link color="primary" href="/home">Primary</Link>
<Link color="critical" href="/delete">Critical</Link>
<Link color="positive" href="/success">Positive</Link>
<Link color="warning" href="/warning">Warning</Link>
<Link color="inherit">Inherit</Link>

With Icons

Add an icon to the start of the link:
import { Link } from 'reshaped';
import IconExternal from '@/icons/External';

<Link icon={IconExternal} href="https://example.com">
  External Link
</Link>

Internal Navigation

<Link href="/dashboard">
  Go to Dashboard
</Link>
<Link href="https://example.com" attributes={{ target: "_blank", rel: "noopener" }}>
  Visit Example
</Link>

With Click Handler

<Link
  href="/page"
  onClick={(e) => {
    e.preventDefault();
    // Custom navigation logic
  }}
>
  Custom Navigation
</Link>

States

Disabled State

Disable user interaction:
<Link disabled href="/unavailable">
  Unavailable Link
</Link>

Props

variant
'plain' | 'underline'
default:"underline"
Link render variant
color
'inherit' | 'critical' | 'primary' | 'positive' | 'warning'
default:"primary"
Link color based on color tokens
icon
React.ComponentType
SVG component for the icon at the start position
href
string
URL to navigate to when clicked
disabled
boolean
default:"false"
Disable user interaction
onClick
(event: React.MouseEvent) => void
Callback when the link is clicked
type
string
HTML type attribute
stopPropagation
boolean
Stop event propagation when clicked
render
function
Custom render function for advanced use cases
className
string
Additional CSS class name
attributes
object
Additional HTML attributes
children
React.ReactNode
Link content

Build docs developers (and LLMs) love