Coming from Orbiter, you should be aware of the following changes:
Link
,IconLink
andTextLink
have all been merged into one.LinkAsButton
has been removed. It is now possible to use theLink
component without anhref
attribute.
A link allows a user to navigate to a different location.
The visual style of the link.
Size of the link.
Whether the link should be displayed with a quiet style.
Whether the link should open in a new tab.
The inline style for the element. A function may be provided to compute the style based on component state.
Whether the element should receive focus on render.
A URL to link to. See MDN.
Hints at the human language of the linked URL. SeeMDN.
The target window for the link. See MDN.
The relationship between the linked resource and the current page. See MDN.
Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN.
A space-separated list of URLs to ping when the link is followed. See MDN.
How much of the referrer to send when following the link. See MDN.
Options for the configured client side router.
The children of the component. A function may be provided to alter the children based on component state.
The CSS className for the element. A function may be provided to compute the class based on component state.
Handler that is called when the press is released over the target.
Handler that is called when a press interaction starts.
Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
Handler that is called when the press state changes.
Handler that is called when a press is released over the target, regardless of whether it started on the target or not.
Handler that is called when the element receives focus.
Handler that is called when the element loses focus.
Handler that is called when the element's focus status changes.
Handler that is called when a key is pressed.
Handler that is called when a key is released.
Handler that is called when a hover interaction starts.
Handler that is called when a hover interaction ends.
Handler that is called when the hover state changes.
Whether the link is disabled.
Defines a string value that labels the current element.
Identifies the element (or elements) that labels the current element.
Identifies the element (or elements) that describes the object.
Identifies the element (or elements) that provide a detailed, extended description for the object.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null
value indicates that the local props completely override all props received from a parent.
A Link
uses the following components.
Links can be disabled.
An external text link will render by default with rel="noopener noreferrer"
and target="_blank"
attributes.
When a <Link>
does not have an href prop, it is rendered as a <span role="link">
instead of an <a>
. Events will need to be handled in JavaScript with the onPress
prop.
Note: this will not behave like a native link. Browser features like context menus and open in a new tab will not apply.
Links can be presented in different variants.
Links can be presented in different sizes.
The size can also be inherited.
Links can contain an icon.
Non standard start icons can be provided to handle special cases. However, think twice before adding start icons, end icons should be your go to.
A link's content can be a single icon. When using this variant, an accessible name must be provided through the aria-label
prop. See WCAG practices.
All links can have a quiet style, without an underline. This style should only be used when the placement and context of the link is explicit enough that a visible underline isn’t necessary.
A button can be rendered as a react router link when using the href
property and setting the navigate property on the HopperProvider
When the colors from the variant props are not enough, you can use the color
prop to set the color of the link. This removes the hover and focus colors from the link. Use the color props when a link needs to be placed on top of a colored background or visual. Make sure that the background and the link color meet the minimum color contrast ratio.
A link's content can be an image element.
Coming from Orbiter, you should be aware of the following changes:
Link
, IconLink
and TextLink
have all been merged into one.LinkAsButton
has been removed. It is now possible to use the Link
component without an href
attribute.