When a link appears within body copy, we call it an inline link.
In legal copy, inline links have smaller font.
An icon is added to links in inline copy when they take a user beyond Canada Post’s digital properties.
Links either go somewhere or do something. Know which use is appropriate to get the most out of them.
Though links are visually similar, there are different kinds with different uses.
When a link appears within body copy, we call it an inline link.
In legal copy, inline links have smaller font.
An icon is added to links in inline copy when they take a user beyond Canada Post’s digital properties.
Use the codes below to add this component to your project. Download the latest version of the library to easily implement our full range of components.
Execute the following command to install this component.
Import the following into your app.module.ts file.
<cpc-ds-links link="http://git.com" body='Setting Class Name' target="_blank"> </cpc-ds-links>
<cpc-ds-links fragment="education" [routerLink]="['/user/khan']" body='All Params' [queryParams]="{debug: true, name: 'goldey'}" linkState="{tracingId: 123}" [externalLink] = "false"> </cpc-ds-links>
<cpc-ds-links ariaRole="button" link="http://canadapost.ca" body='Canada Post'> </cpc-ds-links>
<p> Lorem ipsum dolor sit amet, <lib-ds-links ariaRole="link" link="#" body='consectetur'></lib-ds-links> </p>
<p class="legal">Lorem ipsum dolor sit amet, <lib-ds-links ariaRole="link" link="#" body='consectetur'></lib-ds-links></p>
<lib-ds-links className="external" link="#" body='External link default' target="_blank" ariaLabel="External link default (Opens in new tab)"></lib-ds-links>
<p>Lorem ipsum dolor sit amet, <lib-ds-links className="external" ariaRole="link" link="#" body='External link default' target="_blank" ariaLabel="External link default (Opens in new tab)"></lib-ds-links></p>
Name | Type | Default | Description |
---|---|---|---|
link | string |
URL to follow |
|
body | string |
Link text. The language service will be used to pass the EN or FR text |
|
className | string |
Can add additional classes to the link |
|
ariaRole | string | link |
There are 2 types available:
|
target | string | _self |
Either link opens in same tab ( |
ariaLabel | string |
Use for accessibility. |
|
routerLink | string |
Router link for angular. |
|
queryParams | param |
Query parameters pass to link
|
|
fragment | string |
Link fragment |
|
linkState | any |
State of the link |
|
externalLink | boolean | false |
Confirm if link is external |
Import the following into your theme or page.
<script src="[JS-PLACE-HOLDER]"></script>
<a href="#">Link Text</a>
<a role="button" href="#">Link Text</a>
Note that this component may require additional styling.
Note that this component may require additional styling.
When the link has focus, the Enter key activates the link.
It's important that both the appearance and role of a component match the function it provides. Links are used to direct the user somewhere. Buttons are used to carry out an action.
When elements have the visual style of a button but perform the actions of a link (or vice versa), giving that element a link role helps assistive technology users understand its function and predict its expected behaviour.
In addition to reading links in the context of a full page, screen reader users can also access a collected list of the links on that page. This list can be traversed quickly and sorted in several ways (for example, alphabetically). Because this list separates a link from its original context, it's critical that any link text is unique from similar links and provides enough information on its own to support being quickly navigated.
For a better experience, avoid ambiguous link text like ‘Click here’ or ‘Read more,’ which don't provide enough information when separated from the page’s full context. If these kinds of link texts can't be avoided, the experience can be improved for screen readers in one of the following ways:
When testing a link, the tester must ensure: