The PlumaLink component renders a styled version of PlainLink. Just like PlainLink, it will use PlumaProvider's linkComponent, if it exists.

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';
<Link
	href="https://customer.io"
>
	Customer.io
</Link>

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

<Link
	href="https://customer.io"
	isExternal={true}
>
	Customer.io
</Link>

Primary

Underlined

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

<Text>
	<Link
		href="https://customer.io"
		isUnderlined={true}
		icon="manage"
	>Settings</Link>
</Text>

Secondary

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

<Text>
	<Link
		href="https://customer.io"
		variant="secondary"
		icon="manage"
	>Settings</Link>
</Text>

Underlined

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

<Text>
	<Link
		href="https://customer.io"
		variant="secondary"
		isUnderlined={false}
		icon="manage"
	>Settings</Link>
</Text>

Icons

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

<Text>
	<Link
		href="https://customer.io"
		icon="manage"
	>Settings</Link>
</Text>

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

<Text>
	<Link
		href="https://customer.io"
		icon="chevron-right"
		iconPosition="trailing"
	>Go somewhere</Link>
</Text>

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:

<Text>
	<Link
		href="https://customer.io"
		iconSrc="https://img.icons8.com/?size=256&id=19978&format=png"
		iconPosition="trailing"
	>Go somewhere</Link>
</Text>

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

<Text>
	<Link
		href="https://customer.io"
		iconSrc="https://img.icons8.com/?size=256&id=19978&format=png"
		iconPosition="leading"
	>Go somewhere</Link>
</Text>

<Text>
	<Link
		href="https://customer.io"
		iconSrc="https://img.icons8.com/?size=256&id=19978&format=png"
		iconPosition="trailing"
	>Go somewhere</Link>
</Text>

<Text>
	<Link
		href="https://customer.io"
		iconSrc="https://img.icons8.com/?size=256&id=19978&format=png"
	/>
</Text>

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).

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

<Text>
	<Link
		onClick={() => { console.log('Button clicked'); }}
	>
		I am actually a button
	</Link>
</Text>

API