Link
Link takes people to another page or another place, inside a sentence or on its own line.
Use a Link to go somewhere, such as another page, a section or another site. To perform an action, such as saving or deleting, use a Button. A Link renders an <a> element, and its text stays selectable and wraps across lines like the sentence around it.
Without size and weight, a link matches the text around it. It uses the accent tone by default. Set tone when the destination carries a meaning, such as destructive, or neutral when the link should not draw attention.
A link is always underlined, because colour alone does not identify a link (WCAG 1.4.1) and a touch screen has no hover. The underline is a light grey line, and it changes to the colour of the text when the pointer is over the link.
To use your router's link component, or an anchor with target and rel, pass it to render. Link adds its text styles, underline and focus ring, and the element keeps its own attributes.
Tab moves focus to a link and Enter follows it. A screen reader announces it as a link and uses its text as its name, so write text that makes sense on its own, such as "the plans on this workspace" rather than "click here".
- Button when pressing it does something where they are.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
render? | RenderElement | Renders the link as a different element, such as your framework's link component or an <a> with target and rel. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | The text size step, from 1 to 9. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | The meaning of the link, which sets the colour of the text and the underline. |
weight? | "regular" | "medium" | "semibold" | The font weight, by name. |
It also takes every prop of a <a>.
emphasis— People need to find a link, and a lower emphasis would fade its colour and make it harder to find. To make a link less prominent, give it a smallersize.- A style for visited links — Browsers hide visited styles from scripts to protect a person's history, so the package cannot test a visited style and does not include one.
- An underline that shows only on hover — A person who cannot tell the link's colour from the text must still find it, and a touch screen has no hover. The underline is always visible, and only its colour changes on hover.
- A larger tap area — WCAG exempts links inside a sentence from the minimum target size, and a link cannot grow a larger area without moving the text around it.