Skip to main content

Link

The Link component is used to render clickable hyperlinks that navigate users to different URLs. It supports properties such as href, children, target, and styling options.

Usage

Box

Example
import { Link } from "@tiendanube/nube-sdk-jsx";

function MyComponent() {
return (
<Link href="https://www.google.com">Hello World</Link>
);
}

You can also open links in a new tab:

Example with target
import { Link, Box } from "@tiendanube/nube-sdk-jsx";

function MyComponent() {
return (
<Box>
<Link href="https://www.tiendanube.com" target="_blank">
Visit Tiendanube
</Link>
</Box>
);
}

When using the Link component, the behavior differs based on whether the URL is external or internal:

  • External links: When a user clicks on a link to an external domain (outside the store), a confirmation modal will appear asking the user for permission to redirect. This provides an extra layer of security and transparency.
  • Internal links: Links to pages within the same store domain do not trigger the confirmation modal and navigate directly.

This behavior is automatic and does not require any additional configuration from the developer.

Properties

PropertyTypeRequiredDescription
hrefstringYesThe URL destination of the link. Must use "https://" or "http://".
childrenstringYesThe text content or label of the link.
target"_blank"NoOpens the link in a new tab. Only "_blank" is supported.
colorstringNoThe link color (can be CSS variable like "var(--primary-color)").
styleStyleSheetNoCustom styles for the link.
idstringNoOptional unique identifier for the component.