buntal/components

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

View source on GitHub

Type Definition

function Link({
  href,
  ref,
  children,
  ...props
}: {
  href: string
  ref?: React.Ref<HTMLAnchorElement>
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element

Parameters

ParameterTypeRequiredDefaultDescription
hrefstring✅-The URL to navigate to. Supports internal routes, hash navigation (#element), and back navigation (-1)
refReact.Ref<HTMLAnchorElement>❌-Reference to the underlying anchor element
childrenReactNode❌-Content to display inside the link
...propsReact.AnchorHTMLAttributes<HTMLAnchorElement>❌-Additional HTML anchor element attributes

Properties

PropertyTypeRequiredDefaultDescription
hrefstring✅-The destination URL or path for the link. Supports internal routes, hash navigation (#element), and back navigation (-1)
refReact.Ref<HTMLAnchorElement>❌-Reference to the underlying anchor element
childrenReactNode❌-Content to display inside the link
...propsReact.AnchorHTMLAttributes<HTMLAnchorElement>❌-Additional HTML anchor element attributes (className, style, onClick, etc.)

Last modified: 2026-10-02