# Link

> Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.

```jsx
<Link href="#">Sign up</Link>
```

## API Reference

This component is based on the `a` element and supports [common margin props](/themes/docs/overview/layout#margin-props).

| Prop                                                                                                                                                                   | Type                                                      | Default  |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | -------- |
| `asChild`Render one explicit target with merged props and behavior, not a cloned child. Read our [Composition](/primitives/docs/guides/composition) guide for details. | `boolean`                                                 | —        |
| `size`                                                                                                                                                                 | `Responsive<enum>`                                        | —        |
| `weight`                                                                                                                                                               | `Responsive<"light" \| "regular" \| "medium" \| "bold">`  | —        |
| `trim`Trims the leading whitespace from the start or end of the text.                                                                                                  | `Responsive<"normal" \| "start" \| "end" \| "both">`      | —        |
| `truncate`Truncates text with an ellipsis. Be aware of [common pitfalls](https://css-tricks.com/flexbox-truncated-text/) in flex layouts.                              | `boolean`                                                 | —        |
| `wrap`Controls the wrapping behavior of the text. See the corresponding [text-wrap](https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap) values for details.    | `Responsive<"wrap" \| "nowrap" \| "pretty" \| "balance">` | —        |
| `underline`Sets the visibility of the underline affordance.                                                                                                            | `"auto" \| "always" \| "hover" \| "none"`                 | `"auto"` |
| `color`Overrides the accent color inherited from the Theme. See the [color guide](/themes/docs/theme/color) for more details.                                          | `enum`                                                    | `""`     |
| `highContrast`Uses a higher contrast color for the component.                                                                                                          | `boolean`                                                 | —        |

## Examples

### Size

Use the `size` prop to control the size of the link. The prop also provides correct line height and corrective letter spacing—as text size increases, the relative line height and letter spacing decrease.

```jsx
<Flex direction="column" gap="3">

	<Link href="#" size="1">

		Sign up

	</Link>

	<Link href="#" size="2">

		Sign up

	</Link>

	<Link href="#" size="3">

		Sign up

	</Link>

	<Link href="#" size="4">

		Sign up

	</Link>

	<Link href="#" size="5">

		Sign up

	</Link>

	<Link href="#" size="6">

		Sign up

	</Link>

	<Link href="#" size="7">

		Sign up

	</Link>

	<Link href="#" size="8">

		Sign up

	</Link>

	<Link href="#" size="9">

		Sign up

	</Link>

</Flex>
```

### Weight

Use the `weight` prop to set the text weight.

```jsx
<Flex direction="column">

	<Link href="#" weight="regular">

		Sign up

	</Link>

	<Link href="#" weight="medium">

		Sign up

	</Link>

	<Link href="#" weight="bold">

		Sign up

	</Link>

</Flex>
```

### Truncate

Use the `truncate` prop to truncate text with an ellipsis when it overflows its container.

```jsx
<Flex maxWidth="150px">

	<Link href="#" truncate>

		Sign up to the newsletter

	</Link>

</Flex>
```

### Color

Use the `color` prop to assign a specific [color](/themes/docs/theme/color).

```jsx
<Flex direction="column">

	<Link href="#" color="indigo">

		Sign up

	</Link>

	<Link href="#" color="cyan">

		Sign up

	</Link>

	<Link href="#" color="orange">

		Sign up

	</Link>

	<Link href="#" color="crimson">

		Sign up

	</Link>

</Flex>
```

### High-contrast

Use the `highContrast` prop to increase color contrast with the background.

```jsx
<Flex direction="column">

	<Link href="#" color="gray">

		Sign up

	</Link>

	<Link href="#" color="gray" highContrast>

		Sign up

	</Link>

</Flex>
```

### Underline

Use the `underline` prop to manage the visibility of the underline affordance.

```jsx
<Flex direction="column">

	<Link href="#" underline="hover">

		Sign up

	</Link>

	<Link href="#" underline="always">

		Sign up

	</Link>

</Flex>
```
