Anchor Design System

Link3.0

The Link component enables users to navigate between pages with a single click. Styled to mimic a traditional hyperlink, it semantically renders as an HTML `<a>` element.

Installation

npm i @tryg/ui-library

Usage

Individual only imports the desired component, and only needs to be included once within the application. Which is beneficial to keep the application size small.

Webcomponent
<script type="module">
  import { defineCustomElement } from '@tryg/ui-library/dist/components/anchor-link';
  defineCustomElement();
</script>
<anchor-link href="http://tryg.com/">Some text here</anchor-link>

Global only needs to be defined once in the application, but it will import all components even the ones that are not in use..

Webcomponent
<script type="module">
  import { defineCustomElements } from '@tryg/ui-library/dist/loader';
  defineCustomElements();
</script>
<anchor-link href="http://tryg.com/">Some text here</anchor-link>

Inside of a paragraph

Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, <anchor-link href="http://tryg.com/">consectetur</anchor-link>, adipisci velit...

Variants

<anchor-link href="http://tryg.com/" variant="black">Some text here</anchor-link>
<anchor-link href="http://tryg.com/" variant="brand">Some text here</anchor-link>
<anchor-link href="http://tryg.com/" variant="white">Some text here</anchor-link>

External

<anchor-link href="http://tryg.com/" is-external>Some text here</anchor-link>

API

anchor-link

Properties

PropertyAttributeDescriptionTypeDefault
downloaddownloadThis attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). Documentationstringundefined
hrefhrefContains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. Documentationstringundefined
isExternalis-externalMarking the link as external will add target="_blank" and rel="noopener noreferrer" attributes to the link, along with an icon illustrating to the user they're about to leave the page.booleanundefined
pingpingThe ping property is a space-separated list of URLs. When the link is followed, the browser will send POST requests with the body PING to the URLs. Documentationstringundefined
referrerpolicyreferrerpolicyHow much of the referrer to send when following the link. Documentation"no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"undefined
relrelSpecifies the relationship of the target object to the link object. The value is a space-separated list of link types.stringundefined
targettargetSpecifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top". Documentation"_blank" | "_parent" | "_self" | "_top"undefined
typetypeHints at the linked URL's format with a MIME type. No built-in functionality. Documentationstringundefined
variantvariant"black" | "brand" | "white"'black'

Dependencies

Depends on

Graph


Built with StencilJS

On this page