# LinkProps

**Kind:** Interface

Props for the `Link` component. Also supports:
* `AriaProps`
* `LinkStyleProps`

## Properties

### `children?`

Type: `React.ReactNode | string`

The contents of the link.

### `className?`

Type: `undefined | string`

Additional class names to apply to the link.

### `dataAttributes?`

Type: `DataAttributesProp`

Data attributes that are spread onto the element, e.g. `dataAttributes={{'data-*': '...'}}`.

### `href`

Type: `string`

The target URL or URL fragment for the link.

### `icon?`

Type: `IconName | ReactElement`

The name of the icon or a react node. For more details, see the `list of supported icons`.

### `id?`

Type: `undefined | string`

The `id` attribute.

### `size?`

Type: `TextSizeProp`

The size of the link. Defaults to `default`. Can be a responsive prop object.

### `style?`

Type: `React.CSSProperties`

Additional styles to apply to the link.

### `tabIndex?`

Type: `undefined | number`

Indicates if the link can be focused and if/where it participates in sequential keyboard navigation.

### `target?`

Type: `undefined | string`

Specifies where to display the linked URL.

### `underline?`

Type: `undefined | false | true`

Adds an underline to the link when true.

### `variant?`

Type: `LinkVariant`

The variant of the link, which defines the color. Defaults to `default`.

---

## Link

**Kind:** Component

A styled link component with security benefits.

[[ Story id="link--example" title="Link example" ]]

## Security benefits

This component is a styled wrapper around the `<a>` tag that offers a few security benefits:

- Limited XSS protection. If the `href` starts with `javascript:` or `data:`, `http://` will be prepended.
- There is [reverse tabnabbing prevention](https://www.owasp.org/index.php/Reverse_Tabnabbing). If `target` is set, the `rel` attribute will be set to `noopener noreferrer`.

Developers should use `Link` instead of `a` when possible.

**Parameters:**
- `props` (`LinkProps`)
- `ref` (`React.Ref<HTMLAnchorElement>`)

**Returns:** `Element`
