Text Link

Text link for inline internal and external links with router integration, color inheritance, underline control, and weight options.

import { TextLink } from "@plexui/ui/components/TextLink";

Examples

Overview

Inline usage

You can use the responses endpoint to generate text. You can either use the API directly from an HTTP client of your choice, or use one of the official SDKs for your preferred language.

Default inheritance

colorClassName

You can use the responses endpoint to generate text. You can either use the API directly from an HTTP client of your choice, or use one of the official SDKs for your preferred language.

Primary color

Sample text with a primary link

Underline

Sample text with a subtle link

Font weight

API

PropTypeDefaultDescription
childrenReactNode—Link content
hrefstring—URL. An http:// or https:// URL is external
tostring | object—Router link destination (internal); its type comes from the link component
primarybooleanfalsePrimary color, no default underline
underlinebooleantrueUnderline (default true unless primary)
forceExternalboolean—Force external link behavior
asComponent—Link component (e.g. Next Link)
targetstring—Where to open the link. External links default to _blank
classNamestring—Extra classes on the link

External links render an <a> with target="_blank" (unless you pass target) and rel="noopener noreferrer". Without href or to, TextLink renders a <span role="button">; with an onClick it takes Tab and runs on Enter or Space. Other anchor attributes are forwarded.

Configure your Router

Wrap your app in PlexUIProvider and pass your router's Link component. You can also pass the Link component to the as prop on TextLink for component-level override.

import { PlexUIProvider } from "@plexui/ui/components/PlexUIProvider"
import { Link } from "react-router"

export function App() {
  return (
    <PlexUIProvider linkComponent={Link}>
      ...
    </PlexUIProvider>
  )
}

<TextLink to={{ pathname: "/help" }} prefetch="intent">Get Help</TextLink>
import Link from "next/link"

<TextLink as={Link} href="/dashboard">View Dashboard</TextLink>

Styling

Text Link reads these component tokens. Override them at any scope to restyle it:

  • --link-font-weight: font weight (default inherit)
  • --link-gap: gap (default spacing(0.5))
  • --link-primary-text-color: primary text color (default light-dark(var(--blue-500), var(--blue-300)))
  • --link-primary-text-color-hover: primary text color hover (default light-dark(var(--blue-600), var(--blue-400)))
  • --link-radius: radius (default var(--radius-sm))
  • --link-underline-decoration-offset: underline decoration offset (default 0.1em)