Actions
Link
A text link in the body text style, underlined, that navigates with wire:navigate and marks itself when it points to the current page. Use it inside text and for secondary actions; for a link that looks like a button, use tk:button with href.
Nothing to show
An <a> with the text underlined, which loses the underline on hover. Clicking it navigates with wire:navigate, without a full page load. While the current URL is /terms or a page under it, the link has aria-current="page".
External links #
Opens in a new tab, without wire:navigate, with an icon after the text. target="_blank" on the tag does the same, and also adds rel="noopener noreferrer" when there is no rel.
Nothing to show
Style #
The first has no underline until hovered, in smaller, muted text. The second builds the URL from a route and is blue.
Nothing to show
Text style #
The props of tk:text work on a link: size, variant (strong, subtle, accent), color and weight.
Icons, badge and info #
The element props sit around the text: icon, icon-trailing, badge, and info for a help icon with a tooltip.
Nothing to show
Disabled and no href #
disabled drops the href and sets aria-disabled. Without href or route the tag renders a <p> with the link style.
Nothing to show
Navigation from data #
Links built with @foreach. The one that points to the current page gets aria-current=page (here, Link); exact limits that to its own URL.
Nothing to show
Customization #
Classes go to the <a>; prefixed attributes like icon-trailing: reach the icons.
Nothing to show
Reference
tk:link
| Prop | Type | Default | Description |
|---|---|---|---|
underline |
bool | true |
true underlines the link and removes the underline on hover; false does the opposite. |
Also accepts the props of tk:text (size, scale, weight, variant, color), the element props (label, icon, iconTrailing, badge...), and what makes an element a link: href, route, parameters, external, navigate, current, exact, matchQuery. See Element.
Slots
| Slot | Description |
|---|---|
| default | The link text, in place of label. |
Customization
Classes and attributes go to the <a> element; the parts take the prefixes of the element props (icon:, icon-trailing:...).
Nothing to show
Accessibility
A native <a> with href, so it is reached with Tab and opened with Enter. The link to the current page gets aria-current="page". A disabled link (disabled) has no href, role="link" and aria-disabled="true".
Behavior notes
- Without
hreforroute, it renders a<p>with the link style and nothing to click. - Links to a file (
.pdf,.zip...) and external links skipwire:navigate. - A link opened in a new tab (
externalortarget="_blank") getsrel="noopener noreferrer", unless it sets its ownrel.