The page navigation is complete. You may now navigate the page content as you wish.
Skip to main content

Standalone Link

A link used in isolation and not as a part of surrounding body text.

The Link::Standalone component handles the generation of:

  • an HTML anchor element <a> that points to an external URL (when using a @href argument)
  • an Ember component <LinkTo> that points to an internal application link or resource (when using a @route argument)

Usage

When to use

  • To navigate to a new destination, either internally or externally.
  • As a standalone element or within a Button Set, use a (Link) Standalone

When not to use

  • Within a body of text, use a Link (Inline)
  • To trigger an action or event, like a form submission, use a Button

Size

In most cases use a medium size, but use a link size that best fits the UI.

For example:

  • don’t use large links in tables.

Type

Primary

Use the primary variant as the default and for more important links.

For example when navigating the user to View clusters:

Take care when needing multiple links on a page; using too many primary links can detract from the end goal.

Secondary

Use the Secondary variant for less important links, when the action color can’t be used, or when creating a list of links.

For example in an Install page, “Learn more about Vault”

Icon position

A Link (Standalone) can include leading or trailing icons. Avoid creating links with both leading and trailing icons.

Leading

In most cases, use leading icons. Choose icons that add meaning and clarity to the action described in the link’s text.

You may also want to use the leading position when using service icons (i.e. GitHub).

Trailing

If the link is internal and when none of the icons add any meaning to the link or meet your needs, we recommend using a simple (arrow-right).

Using the (external-link) icon in the trailing position is highly recommended for external links if the link points to an external URL.

If adding a specific icon is relevant to the user experience, and none of the icons available in Flight fit your use case, consider requesting a custom icon.

Common patterns

Within button sets

Link (Standalone) can commonly be seen within button sets.

When included in a ButtonSet, Link (Standalone) is generally used for navigating between steps in a multi-page form (ie. directing the user back to the previous step) or for linking to external documentation. As such, they should be displayed as the right most button in the row.

Content

  • Text should be short and to the point (~25 characters). Text labels should not consist of full sentences, but should provide enough context to be useful.
  • Language should be used consistently within each product (ie. when using "Edit" on one page, use that same convention throughout the rest of the application, not "Change").

How to use this component

The most basic invocation requires both icon and text to be passed and one of the two @href or @route arguments.

<Hds::Link::Standalone @icon="film" @text="Watch tutorial video" @href="..." />

Icon position

By default the icon is placed before the text. If you would like to position it after the text, define @iconPosition:

<Hds::Link::Standalone @icon="film" @iconPosition="trailing" @text="Watch tutorial video" @href="..." />

Color

There are two available colors for a Link (Standalone): primary and secondary. The default is primary. To use a different color, declare another value for @color:

<Hds::Link::Standalone @color="primary" @icon="collections" @text="Read tutorial" @href="..." />

Size

There are three sizes available: small, medium and large. The default is medium. To use a different size, declare a value for @size:

<Hds::Link::Standalone @icon="collections" @text="Read tutorial" @size="small" @href="..." />

URLs and routes handling

You can generate a standalone link passing a @href or a @route to the component. If none of the two is provided, the component will throw an error.

The Link::Standalone component internally uses the generic Hds::Interactive component. For more details about how this low-level component works please refer to its documentation page.

With @href

If you pass a @href argument a <a> link will be generated:

<Hds::Link::Standalone @icon="terraform" @text="Request a demo" @href="https://www.hashicorp.com/request-demo/terraform" />

When using the @href argument the component adds by default the attributes target="_blank" and rel="noopener noreferrer" to the <a> element (because this is the most common use case: internal links are generally handled using a @route argument). If the href points to an internal link, or uses a different protocol (eg. "mailto" of "ftp") you can pass @isHrefExternal=true to the component and it will not add the target and rel attributes (but you can pass yours if needed, using the ...attributes spreading. For more details see the Hds::Interactive component.

With @route

If you pass a @route argument a <a> link will be generated using a <LinkTo> Ember component:

<Hds::Link::Standalone @icon="collections" @text="Go to the index page" @route="my.page.route" @model="my.page.model" />

If the route is external to your current engine you have to pass also @isRouteExternal=true to the component so that it will use <LinkToExternal> instead of a simple <LinkTo> for the @route. For more details see the Hds::Interactive component

All the standard arguments for the <LinkTo/LinkToExternal> components are supported (eg. models/model/query/current-when/replace).

Component API

Name
size
Type
enum
Values
  • small
  • medium (default)
  • large
Name
color
Type
enum
Values
  • primary (default)
  • secondary
Name
text
Type
string
Required
Required
Description
The text of the link. If no text value is defined an error will be thrown.
Name
icon
Type
string
Required
Required
Description
Use this parameter to show an icon. Any icon name is acceptable. The icon is required to make the component accessible.
Name
iconPosition
Type
enum
Values
  • leading (default)
  • trailing
Description
Positions the icon before or after the text.
Name
href
Description
This is the URL parameter that is passed down to the <a> element.
Name
isHrefExternal
Type
boolean
Values
  • false (default)
  • true
Description
This controls if the <a> link is external and so for security reasons we need to add the target="_blank" and rel="noopener noreferrer" attributes to it.
Name
route models model query current-when replace
Description
These are the parameters that are passed down as arguments to the <LinkTo/LinkToExternal> component.
Name
isRouteExternal
Type
boolean
Values
  • false (default)
  • true
Description
This controls if the "LinkTo" is external to the Ember engine (more details here) in which case it will use a <LinkToExternal> instead of a simple <LinkTo> for the @route.
Name
…attributes
Description
This component supports use of ...attributes.

Anatomy

Anatomy of the Standalone Link

Element Usage
Leading Icon* Optional
Text Required
Trailing Icon* Optional
Focus Ring Focus state only

*A Link (Standalone) should always include an icon

States

Primary

Primary state of the link standalone component

Secondary

Secondary state of the link standalone component

Best Practices

Annotations

Provide annotations alongside each design of the non-visual experience. This could look like:

Annotation of focus order of the link

Animations or transitions will not take place if the user has prefers-reduced-motion enabled in their browser.

Applicable WCAG Success Criteria

This section is for reference only. This component intends to conform to the following WCAG Success Criteria:


Support

If any accessibility issues have been found within this component, please let us know by submitting an issue.