Skip to content

Anchor

A standard hyperlink rendered as a clickable text element.

new Anchor("Mateu documentation", "https://mateu.io")
PropertyTypeDefaultDescription
textString—Link text
urlString—Target URL (absolute or relative)
targetStringnullBrowser target, e.g. _blank to open the link in a new tab. _blank links are emitted with rel="noopener" automatically.
styleString""Inline CSS
cssClassesString""CSS class names
// External link
var website = new Anchor("Visit our website", "https://example.com");
// Internal navigation
var orders = new Anchor("View all orders", "/orders");
// Open in a new tab (rendered with rel="noopener")
var newTab = Anchor.builder()
.text("Visit our website")
.url("https://example.com")
.target("_blank")
.build();
// Builder form
var pdf = Anchor.builder()
.text("Download PDF")
.url("/reports/monthly.pdf")
.build();
VerticalLayout.builder()
.spacing(true)
.content(List.of(
new Text("Need help?"),
new Anchor("Read the documentation", "https://mateu.io/docs"),
new Anchor("Contact support", "mailto:support@example.com")
))
.build()

See it live in the Explorer: Text, Markdown, links & lists