Anchor
A styled hyperlink — a native <a> with mantle's link styling, focus treatment, optional leading/trailing icon, and a safer default for the rel attribute. Use for links that point outside the current application.
The <Anchor> element, with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. See the MDN docs for more information.
When to use
- External URLs (docs, marketing pages, third-party sites).
- Links to files or
mailto:/tel:destinations.
When not to use
- Internal application routes — prefer the framework router's link primitive (
react-router<Link>) so client-side navigation kicks in. Keep mantle's styling by composing (see Polymorphism). - For triggering an action — use a
Buttoninstead. If it doesn't navigate, it's not a link.
Icons
Pass icon (a phosphor or custom SVG) and optionally iconPlacement ("start" default, or "end") to render a small inline icon — useful for "external link" or "download" affordances. Icons are decorative; the link text must still describe the destination on its own.
Security
When target="_blank" and rel is omitted, the anchor renders rel="noopener noreferrer". A rel you pass is used as-is. The rel prop accepts an array: duplicates are de-duped and sorted, so it's safe to merge token sets.
Accessibility
Link text must be self-describing: avoid "click here" / "read more". The icon is decorative by default: it renders aria-hidden unless the SVG carries aria-label, aria-labelledby, role, or an explicit aria-hidden. For icon-only links, pass an aria-label.
This link will go to ngrok.com!
You can add icons! This one renders at the start: ngrok docs!
And this icon renders at the end: ngrok dashboard!
Polymorphism
Use the asChild prop to compose the Anchor styling onto another element, most commonly a react-router <Link> for internal, client-side navigation.
API Reference
Anchor
All props from a, plus: