---
title: ButtonLink
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { ButtonLink } from '@telus-uds/components-web'
import { ButtonLink as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'

# ButtonLink

<LibraryInfo figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2F4zJn2Qn6uXOqPP1GVDipy6%2F%25F0%259F%258D%2580-Allium-Components%3Fnode-id%3D224%253A463" />

```jsx live
<ButtonLink href="https://www.telus.com">Go to telus.com</ButtonLink>
```

## Introduction

ButtonLink is a component with the visual appearance of a button but the semantics and behaviour of a link.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

Use ButtonLink where a user is making a choice to advance an action, and acting on that choice takes the user
to another page.

### Alternatives

**Do not** use ButtonLink for:

- A single navigation action that is the only logical next step (or is a step back): consider [ChevronLink](chevron-link)
- Actions that occur immediately on press on the current page: consider [Button](button)
- Actions that occur within the current page or screen; consider [TextButton](text-button)
- General links that are outside of the current action flow: consider [Link](link)

### Accessibility

Insert [A11yText](a11y-text) any time an interactive element's label lacks context
that a sighted user would see in the content around it. Many users of assistive technology explore a page
by cycling through the interactive elements first.

```jsx live
<StackView space={3}>
  <Typography>
    Congratulations! Your account now qualifies for our exclusive Premium Plan.
  </Typography>
  <ButtonLink href="https://telus.com">
    Sign up <A11yText text="to Premium Plan" />
    now
  </ButtonLink>
  <Link href="https://telus.com">
    View terms and conditions <A11yText text="for Premium Plan" />
  </Link>
</StackView>
```

ButtonLink is treated as a navigational `link` by accessibility tools. It accepts
React Native's accessibility props ([web docs](https://necolas.github.io/react-native-web/docs/accessibility/),
[native docs](https://reactnative.dev/docs/accessibility)).

### Platform considerations

<AvailableOnBoth />

On web, ButtonLink will render as an `<a>` anchor link if a `href` is provided, allowing for
common link actions such as open in new tab.

On native apps, links to web addresses will be opened according to the user's device's link handling
behaviour: usually opening the user's default browser (or choice of browsers) with a back action to return
to the app.

## Props

<PropsTable base={BaseDocs} />

## Tokens

:::warning
Note: `borderWidth` token is deprecated and will be removed in the next major release. Please consider using `borderRightWidth`, `borderLeftWidth`, `borderTopWidth`, and `borderBottomWidth` to achieve the same outcome.
:::

<TokensTable base={BaseDocs} component="ButtonLink" />

### Use of `dataSet`

Use `dataSet` prop to pass custom data attributes. Here's an example:

```jsx live
<ButtonLink
  href="https://www.telus.com"
  dataSet={{ 'field-id': 'test field id', 'entry-id': 'test entry id' }}
>
  Go to telus.com
</ButtonLink>
```

## Variants

ButtonLink's variants are the same as for [Button](button).

## Feedback

<Feedback component="ButtonLink" />
