Link

free

Link gives anchors product focus styling and safe navigation behavior.

import { PiArrowRight } from 'react-icons/pi'
import Link from '@/components/ui/link';

export default function UsageDemo() {

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Link

Examples

Basic

Pair Button with Input when a form needs a clear submit action.

import Link from '@/components/ui/link';

export default function BasicDemo() {
  return (

External

import { PiArrowSquareOut } from 'react-icons/pi'
import Link from '@/components/ui/link';

export default function ExternalDemo() {

Custom Styles

import Link from '@/components/ui/link';

const links = [
  {

Router Adapter

import NextLink from 'next/link';
import type { ComponentPropsWithRef } from 'react';
import { PiArrowRight } from 'react-icons/pi'
import Link from '@/components/ui/link';

API

Link renders an anchor by default. Use render when the anchor props should be handed to a router component instead.

PropDescriptionTypeDefault
childrenLink label or custom inline content.ReactNode-
classNameClass names applied to the rendered link. The component always adds its focus-visible ring classes.string-
hrefDestination URL. Required and forwarded to the rendered element.string-
refRef forwarded to the rendered anchor or adapter component.Ref<HTMLAnchorElement>-
relRelationship attribute. When omitted with target="_blank", Link supplies noopener noreferrer.stringAuto for blank targets
renderElement or component used instead of the default <a> tag. Receives the resolved link props.LinkRenderer-
targetNative anchor target, such as _blank.HTMLAttributeAnchorTarget-
...nativePropsNative anchor props forwarded to the rendered element, excluding href.NativeAnchorProps-

Types

type LinkRenderer = ElementType<LinkRenderProps>;
 
type LinkRenderProps = NativeAnchorProps & {
  href: string;
};
 
type NativeAnchorProps = Omit<ComponentPropsWithRef<'a'>, 'href'>;