BtnLink

Give a destination the emphasis it deserves. BtnLink combines the visual language of a button with the familiar behavior of a real link.

BtnLink

View source · API reference

Use BtnLink to navigate to a page, a section, or an external destination. For an action such as saving, submitting, or opening a dialog, use Btn.

Playground

Change the destination, target, relationship, and appearance. The preview is a working link: its initial destination is a section further down this page. The line beneath it shows the effective navigation attributes. Choose an icon before enabling icon-only mode.

Destinations

One component, three familiar journeys. Internal URLs use the site's public URL resolver during server rendering. Fragment links stay on the page. External links can open a new browsing context with target="_blank".

Target and relationship

When target is _blank and rel is omitted or empty, BtnLink supplies noopener noreferrer. An explicit, non-empty rel replaces that default. Include the relationship tokens you need in the explicit value.

Variants

Thirteen treatments share the same link semantics. Use a strong treatment for the primary destination and quieter ones for supporting navigation. Hover or focus each link to explore its state styling.

Tones

Ten semantic tones express intent through the active theme. Pick a tone for its meaning; keep the destination clear in the link text.

Sizes and icons

Choose sm, md, or lg. An icon can lead or follow the label. Icon-only links need an ariaLabel that explains the destination; the visible slot is hidden in this mode.

You have reached the target used by the same-page examples. The URL fragment changes through native anchor navigation. No click handler or application router is needed.

Back to the playground

Accessibility

  • Give every link a meaningful destination and a name that makes sense in a list of links. Prefer “Read the button guide” to “Click here”.
  • A link with an href is reachable with Tab and activated with Enter. Browser features such as copying its address and opening it in another tab remain available.
  • Let visible text name the link. Supply ariaLabel for an icon-only link, or when the visible text needs more context.
  • Signal when a destination opens in a new tab. The examples include this information in the label.
  • Add aria-current="page" yourself for the current page in a navigation region. BtnLink does not detect the current route.
  • BtnLink has no disabled state. If navigation is unavailable, present explanatory text or omit the link until its destination is available.

API reference

<BtnLink href="/guide/" />

A native <a> with ten public props, one default slot, and the shared button appearance. Static links need no Regor application.

Props accept values or Regor refs. For reactive expressions, pass a computed ref as shown in the playground. Register defineButtonComponents() when mounting a browser app; register defineIconComponents() with the icons used by that app.

Appearance

Icons and labels

Slots and native attributes

Default slot

The visible link label. Accepts text and inline markup; keep other interactive controls outside the link. Hidden when iconOnly is true.

Native attributes

Attributes such as id, class, title, download, and aria-current reach the anchor. Native browser rules still apply to downloads and browsing contexts.

Events

Native anchor events are available in Regor apps. Navigation needs no handler. If you add @click, preserve the browser's default behavior unless your application intentionally handles the navigation.

<BtnLink href="/components/actions/btn-link/" variant="link" aria-current="page">BtnLink</BtnLink>

For actions, see Buttons. To arrange related links and actions, see BtnGroup.