Anchor
A fundamental component for rendering links to external addresses.
When to use
- Link to an external URL: docs, marketing pages, third-party sites.
- Link to a file, or to a
mailto:ortel:address. - Prefer
Buttonwhen the control runs an action and does not navigate. - Prefer
Breadcrumbwhen the links show the path from a root page to the current page.
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. It suits "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.
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
Anchor renders a native <a> with mantle's link styling and focus treatment. Its href can address a web page, a file, an email address, a location on the same page, or anything else a URL can address. See the MDN docs for more information.
All props from a, plus: