# terminal-link

> Create clickable links in the terminal

Latest version **5.0.0** (published 2025-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install terminal-link
pnpm add terminal-link
yarn add terminal-link
bun add terminal-link
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2025-09-08 |
| First published | 2018-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 2 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 670 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | link, hyperlink, url, ansi, escape, terminal, term, console, command-line |

## Links

- npm: https://www.npmjs.com/package/terminal-link
- Repository: https://github.com/sindresorhus/terminal-link
- Homepage: https://github.com/sindresorhus/terminal-link#readme
- Issues: https://github.com/sindresorhus/terminal-link/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/terminal-link

## Dependencies (2)

- [ansi-escapes](https://npm.io/package/ansi-escapes.md) ^7.0.0
- [supports-hyperlinks](https://npm.io/package/supports-hyperlinks.md) ^4.1.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2025-09-08
- 4.0.0 — 2025-03-25
- 3.0.0 — 2021-04-18
- 2.1.1 — 2019-12-18
- 2.1.0 — 2019-12-18
- 2.0.0 — 2019-09-01
- 1.3.0 — 2019-04-06
- 1.2.0 — 2018-12-22
- 1.1.0 — 2018-04-20
- 1.0.0 — 2018-04-04

## README

# terminal-link

> Create clickable links in the terminal

<img src="screenshot.gif" width="301" height="148">

## Install

```sh
npm install terminal-link
```

## Usage

```js
import terminalLink from 'terminal-link';

const link = terminalLink('My Website', 'https://sindresorhus.com');
console.log(link);
```

## API

### terminalLink(text, url, options?)

Create a link for use in stdout.

[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)

For unsupported terminals, by default the link will be printed as plain text with a space separator: `My website https://sindresorhus.com`.

#### text

Type: `string`

Text to linkify.

#### url

Type: `string`

URL to link to.

#### options

Type: `object`

##### fallback

Type: `function | boolean`

Override the default fallback. The function receives the `text` and `url` as parameters and is expected to return a string.

If set to `false`, the `text` will be returned as-is when a terminal is unsupported.

### terminalLink.isSupported

Type: `boolean`

Check whether the terminal's stdout supports links.

Prefer just using the default fallback or the `fallback` option whenever possible.

### terminalLink.stderr(text, url, options?)

Create a link for use in stderr.

Same arguments as `terminalLink()`.

### terminalLink.stderr.isSupported

Type: `boolean`

Check whether the terminal's stderr supports links.

Prefer just using the default fallback or the `fallback` option whenever possible.

## Related

- [terminal-link-cli](https://github.com/sindresorhus/terminal-link-cli) - CLI for this module
- [ink-link](https://github.com/sindresorhus/ink-link) - Link component for Ink
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right

---
_Source: https://npm.io/package/terminal-link · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
