Button Link

Button as a semantic anchor element

import { ButtonLink } from "@plexui/ui/components/Button";

Examples

Overview

Colors & variants

Sizing & roundness

size

Icons

size
iconSize

Block

Disabled

View API Keys

Reference

PropTypeDefaultDescription
childrenReactNodeContent inside the link button
color"primary" | "secondary" | "danger" | "success" | "info" | "discovery" | "caution" | "warning""primary"Visual color
variant"solid" | "soft" | "outline" | "ghost""solid"Style variant
size"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl""md"Control height and typography scale
gutterSize"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl"Override horizontal padding
iconSize"sm" | "md" | "lg" | "xl" | "2xl"Override icon size
hrefstringLink URL
tostring | objectRouter link destination (internal)
asComponentTypeLink component override (e.g. Next Link)
externalbooleanForce external-link behavior
opticallyAlign"start" | "end"Apply optical negative margin alignment
blockbooleanfalseFull width
pillbooleantrueFully rounded
disabledbooleanfalseDisable link
disabledTone"relaxed"Use relaxed visual tone for disabled state
classNamestringCustom classes for the root element

Configure your Router

Provider

// In the root of your app
import { PlexUIProvider } from "@plexui/ui/components/PlexUIProvider"
import { Link } from "react-router"

// Set up types

declare global {
  interface PlexUIConfig {
    LinkComponent: typeof Link
  }
}

// Wrap your app in PlexUIProvider and pass in your router's Link component.
export function App() {
  return (
    <PlexUIProvider linkComponent={Link}>
      {/* other providers... */}
    </PlexUIProvider>
  )
}

// elsewhere - everything just works!
<ButtonLink to={{ pathname: "/help" }} prefetch="intent">
  Get Help
</ButtonLink>

Component-level

You can also pass your Link component to the as prop.

import Link from "next/link"

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