Ritext
Extensions

Link

Insert and manage hyperlinks in the editor.

The Links extension adds a link button to the toolbar. It provides a UI for inserting, editing, and removing hyperlinks.

Import

import { Links } from 'ritext/extension/link';

Usage

const extensions = [Links];

Features

  • Toolbar button to insert/edit a link
  • Link edit menu appears on click
  • Supports opening links in a new tab
  • Parses links from pasted URLs automatically

Configuration

Links.configure({
  openOnClick: false,  // Don't navigate on click (default)
  surface: { bubbleMenu: true },
})

Options

Prop

Type

Rendered Output

Links render as <a> tags with the link CSS class:

<a href="https://example.com" target="_blank" rel="noopener noreferrer" class="link">
  Example
</a>

The .link class is styled by ritext/styles.css as blue, bold, and underlined.

On this page