Links are used to navigate to a new location, open or download an asset, or serve as an inline action.

For more details on how to set up the link component on PlumaProvider, visit the provider's docs.

Usage

Link works just like PlainLink:

import { Link } from '@customerio/pluma-components/react';
Loading editor

The isExternal prop is automatically inferred from the URL (http://, https://, mailto:, tel:), but you can still explicitly set it if needed:

Loading editor

Primary

Underlined

To render the component in the "underlined" variant, use the isUnderlined prop:

Loading editor

Secondary

To render the component in the "secondary" variant, use the variant prop.

Loading editor

Underlined

To render the component without an underline, use the isUnderlined prop:

Loading editor

Icons

A Link can also be rendered with an icon, for example:

Loading editor

The icon can be placed on either side of the text via the iconPosition prop (by default, leading):

Loading editor

Custom icons

If you need to use a custom icon that isn't part of the Pluma Icon set, you can use the iconSrc prop to provide a URL to an image. The image will be automatically sized to match the button's icon size:

Loading editor

Custom image icons support the same positioning options as standard icons:

Loading editor

Loading editor

Loading editor

Two icons at once

iconLeading and iconTrailing are shortcuts for a fixed side, so a link can carry an icon on each side. They render in addition to icon rather than replacing it.

Loading editor

Custom elements

Use elementBefore and elementAfter for leading or trailing content that isn't an icon. elementBefore renders between any leading icon and the text; elementAfter renders between the text and any trailing icon. Both compose with the icons rather than replacing them, and pick up the same spacing the icons use — including when the link sits inside a paragraph.

In React, both are node props. In Ember, they can be passed as a component or, more commonly, via the :elementBefore and :elementAfter named blocks (the text is then provided via the :default block).

Loading editor

You may sometimes need to render a button tag that's styled like the Link component. For example, you might want to render a clickable button inside a paragraph, which will perform an action on click (rather than navigating somewhere).

To do so, pass in the onClick prop to the Link component:

Loading editor

API