# Text Link

A link in text: #0060a9 at 450, navy on hover, never underlined. Focus draws the blue edge and halo around the text.

- Beta: ready to use; its API can still change in a minor release.
- Category: Actions

```tsx
import { TextLink } from "@leap-crm/design-system";
```

## Best practices

- Do: Use it for navigation in text or as a quiet link in a header, like View all under a list of opportunities.
- Do: Use `md` in body text and `sm` in dense rows and section headers.
- Do: Set `external` for a page that opens somewhere else, so the ↗ says the link leaves the CRM.
- Do: Pass your router's link element to `render`, so it keeps its own navigation and takes the link's look.
- Do: Give `size="icon"` an `aria-label` that says where it goes. It shows a bare ↗ with no text.
- Don't: Use it for an action that changes data, like Archive or Send. Use `Button`: a link goes somewhere, a button does something.

## Keyboard

| Keys | What they do |
| --- | --- |
| Enter | Follows the link. |

## Related

- [Button](./button.md)
- [Breadcrumbs](./breadcrumbs.md)
- [Record Chip](./record-chip.md)

## Examples

What the examples import:

```tsx
import { TextLink } from "@leap-crm/design-system";
```

### Sizes

md (14 px) in body text, sm (12 px) in dense rows and section headers, icon for a bare ↗.

```tsx
<div className="flex items-center gap-6">
  <TextLink href="/text-link">View all</TextLink>
  <TextLink size="sm" href="/text-link">
    View all
  </TextLink>
  <TextLink size="icon" href="/text-link" aria-label="Open in LEAP" />
</div>
```

### External

external adds the ↗ after the label for a page that opens elsewhere.

```tsx
<TextLink
  href="https://www.leap.com.au"
  external
  target="_blank"
  rel="noopener noreferrer"
>
  Open the matter in LEAP
</TextLink>
```

### In a sentence

```tsx
<p className="text-neutral-text max-w-sm text-base">
  Jane Citizen has two open opportunities.{" "}
  <TextLink href="/text-link">See them in the pipeline</TextLink>.
</p>
```

### As a router link

Pass your router's link element to render; it takes the link's look and keeps its own navigation.

```tsx
<TextLink render={<a href="/button" />}>Go to Button</TextLink>
```

## Props

Also takes every prop of an <a>, like href, target and rel.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `"md" \| "sm" \| "icon"` | `"md"` | md (14 px) for body text, sm (12 px) for dense rows, icon for a bare ↗ that needs an aria-label. |
| `external` | `boolean` | `false` | Adds the ↗ after the label, for a page that opens somewhere else. |
| `render` | `ReactElement<{ className?: string; children?: ReactNode }>` |  | Renders another element as the link, like a router Link, with the link's look. |
| `children` | `ReactNode` |  | What it shows inside. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
