Skip to content
Focsd homeFocsd homeFocsd
Forms

Link

Navigates somewhere. Always underlined so links are never confused with buttons.

  • Tag: focsd-link
  • Pattern: Link
  • Category: Actions

Example

Read the migration guide or check the status page.

HTML
<p>
Read the <focsd-link href="#">migration guide</focsd-link> or check the
<focsd-link href="https://example.com" external>status page</focsd-link>.
</p>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-link.js';
</script>
<focsd-link href="#">migration guide</focsd-link>

API

Attributes

AttributePropertyTypeDefault
hrefhrefstring—
externalexternalbooleanfalse
targettargetstring—
relrelstring—
downloaddownloadstring | nullnull
hreflanghreflangstring—
typetypestring—
referrerpolicyreferrerPolicystring—
pingpingstring—

Slots

SlotDescription
(default)Default content.

CSS parts

Style the inside of the component with ::part(), for example focsd-link::part(link).

PartDescription
linkThe link element.

Accessibility

  • target="_blank" adds noopener and announces "opens in new tab". download, hreflang, type, referrerpolicy and ping are forwarded.
  • A native <a> inside the shadow root, with focus delegated to it.
  • external opens a new tab and adds "(opens in new tab)" to the accessible name, so the change of context is announced.

Keyboard

KeyAction
EnterFollows the link