Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Global Navigation

  • Navbar
  • BeianFooter
  • Brand
  • AppLauncher
  • Sidebar
  • NavMenu
  • NavigationMenu
  • Menu
  • Menubar
  • Dock
  • BubbleMenu
  • CardNav
  • FlowingMenu
  • GooeyNav
  • PillNav
  • StaggeredMenu

In-page Navigation

  • RouteTabs
  • Tabs
  • Breadcrumb
  • Pagination
  • Anchor
  • Affix
  • BackTop
  • Stepper
  • Steps
  • PageHeader

Actions and Tools

  • Command
  • ContextMenu
  • Toolbar
  • Accordion
  • Collapsible
  • Link
  • AnimatedThemeToggler

Link

link

Renders styled navigation with tone, underline, and external-link behavior.

Usage

Basic usage

Default main color link, underline appears when hovering.

Hulian Documentation
tsx
<Link href="#">Hulian Document</Link>

Tone

tone Switch foreground color: primary / foreground / danger.

Main color linkForeground color linkDangerous link
tsx
<>
  <Link href="#" tone="primary">Main color link</Link>
  <Link href="#" tone="foreground">Foreground color link</Link>
  <Link href="#" tone="danger">Dangerous link</Link>
</>

Underline

underline Control underline timing: hover (default) / always / none.

Hover underlineAlways underlineNo underline
tsx
<>
  <Link href="#" underline="hover">Hover underline</Link>
  <Link href="#" underline="always">Always underline</Link>
  <Link href="#" underline="none">No underline</Link>
</>

External link

external automatically adds target=_blank + rel security attributes, and attaches external link icons.

Base UI official website
tsx
<Link href="https://base-ui.com" external>Base UI official website</Link>

Muted links and the go arrow

tone="muted" rests in the secondary gray and returns to the body color on hover; arrow adds a trailing arrow to links that lead somewhere, nudging forward on hover.

Browse allTailwind
tsx
<>
  <Link href="#" arrow>Browse all</Link>
  <Link href="#" tone="muted" underline="none">Tailwind</Link>
</>

When to use

Use Link for inline navigation to internal or external destinations. It provides tone, underline policy, and secure external-link attributes. Use Button for an action such as submitting a form or opening a dialog; a Link should navigate.

Import

ts
import { Link, linkVariants } from "@hulianui/ui"

Props

Inherits native <a> attributes such as href, target, and onClick, except native color. Adds:

NameTypeDefaultDescription
tone"primary" | "foreground" | "danger" | "muted""primary"Text tone. muted rests in the secondary gray and returns to the body color on hover, for footer links or a row of source links that shouldn't compete with the accent.
underline"always" | "hover" | "none""hover"Underline visibility policy.
externalbooleanfalseAdds target="_blank", rel="noopener noreferrer", and a trailing external-link icon.
arrowbooleanfalseAdds a trailing "go" arrow that nudges forward on hover, for links such as "Browse all →". When external is also set, only the external-link icon renders.
hrefstring-Native navigation destination.
renderReactElement-Custom element for framework routers such as next/link or React Router Link. Styling and Link props merge into this element; the custom element owns href.

Events

EventTypeDescription
onClick(e: MouseEvent<HTMLAnchorElement>) => voidNative anchor click handler; other onXxx events also pass through.

Slots

SlotTypeDescription
childrenReactNodeLink content.

Example

tsx
<Link href="/docs">Hulian documentation</Link>
<Link href="https://base-ui.com" external>Base UI website</Link>
<Link href="#" underline="always" tone="danger">Deletion notes</Link>

// Client-side routing: pass the framework Link through render and put href on it
import NextLink from "next/link"
<Link render={<NextLink href="/posts/1" />}>View details</Link>

<Link href="/components" arrow>Browse all</Link>
<Link href="https://tailwindcss.com" tone="muted" underline="none">Tailwind</Link>

Usage guidelines

  • With external, do not repeat target or rel; the component injects safe values and the icon automatically.
  • For client routing, use render and put href on the rendered element. In <Link href="/a" render={<NextLink />}>, the address remains on the HulianUI layer and does not reach the router component.
  • Wrapping a router link around Link produces nested <a> elements, invalid DOM, and possible hydration errors.

Related

Command · ContextMenu · Toolbar · Accordion · Collapsible · AnimatedThemeToggler

Playground

Example link
<Link href="#">Link</Link>
PreviousCollapsibleNavigationNextAnimatedThemeToggler

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage guidelines
    • Related
  • Playground