Link

Alignment target:@astryxdesign/core v0.7.1 · Link

<Link
  href="/guide/getting-started"
  color="accent"
>
  Read the docs
</Link>

Props #

NameTypeDefaultDescription
hrefstring-Link URL. When omitted, the component renders as a <button>.
asLinkRoot-Root used instead of <a> when the link has an address and is enabled. It receives href and to.
labelstring-Accessible name. Use it when the visible content is not the name, such as an icon-only link. It replaces the link text for assistive technology.
newTabLabelstringLocalized “(opens in new tab)”Screen-reader text after an external link.
sizeLinkSize-Font size, the same steps as body text: sm, md, lg, xl.
weightLinkWeight-Font weight. normal is the same as regular.
maxLinesnumber0Maximum visible lines. 0 does not truncate.
isExternalLinkbooleanfalseWhether the link opens in a new tab and shows an external indicator.
hasUnderlinebooleanfalseWhether the underline is always visible.
colorLinkColor'accent'Link color. Optional: primary, secondary, accent, inherit.
isDisabledbooleanfalseWhether the link is disabled. It cannot navigate or emit click, keeps its Tab stop, and is announced as disabled. A caller role or aria-disabled does not replace that; a caller tabindex still applies.
targetstring-HTML target attribute.
relstring-HTML rel attribute. External links automatically add noopener noreferrer.
downloadstring | boolean-Triggers a download of the linked URL. A string is the suggested filename. true renders a bare download attribute, false renders no attribute at all.
referrerPolicystring-Referrer policy for the link, forwarded as the referrerpolicy attribute.

Events #

NameDescription
clickEmitted on click. Not emitted when disabled.

Slots #

NameDescription
defaultLink text content.

Native attributes #

The root element is an <a>, a <button>, or the component passed to as. A disabled link is always an <a> without an address.

The following are passed to the root element:

  • HTML attributes.
  • aria-* attributes.
  • data-* attributes. data-color always reflects color, so a caller value does not replace it.
  • class.
  • style.