Link
Client-side navigation component that handles internal routing, hash navigation, and history management without full page reloads. Only same-origin URLs are routed client-side; external links, mailto:, javascript:, modifier or middle clicks, target other than _self, and download links behave like a normal anchor. Your onClick runs first and can call preventDefault().
Source
Type Definition
function Link({
href,
ref,
children,
...props
}: {
href: string
ref?: React.Ref<HTMLAnchorElement>
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.ElementParameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
href | string | ✅ | - | The URL to navigate to. Supports internal routes, hash navigation (#element), and back navigation (-1) |
ref | React.Ref<HTMLAnchorElement> | ❌ | - | Reference to the underlying anchor element |
children | ReactNode | ❌ | - | Content to display inside the link |
...props | React.AnchorHTMLAttributes<HTMLAnchorElement> | ❌ | - | Additional HTML anchor element attributes |
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
href | string | ✅ | - | The destination URL or path for the link. Supports internal routes, hash navigation (#element), and back navigation (-1) |
ref | React.Ref<HTMLAnchorElement> | ❌ | - | Reference to the underlying anchor element |
children | ReactNode | ❌ | - | Content to display inside the link |
...props | React.AnchorHTMLAttributes<HTMLAnchorElement> | ❌ | - | Additional HTML anchor element attributes (className, style, onClick, etc.) |
Last modified: 2026-10-02