Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/extension-mention

Package Overview
Dependencies
Maintainers
6
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-mention

mention extension for tiptap

  • 2.11.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created

What is @tiptap/extension-mention?

@tiptap/extension-mention is an extension for the Tiptap editor that allows you to add mention functionality to your text editor. This can be used to mention users, tags, or any other entities within the text.

What are @tiptap/extension-mention's main functionalities?

Basic Mention Setup

This code sets up a basic mention extension with custom HTML attributes and a suggestion list. The suggestion list filters items based on the query.

import { Mention } from '@tiptap/extension-mention';

const mention = Mention.configure({
  HTMLAttributes: {
    class: 'mention',
  },
  suggestion: {
    items: (query) => {
      return [
        { id: 1, label: 'John Doe' },
        { id: 2, label: 'Jane Doe' },
      ].filter(item => item.label.toLowerCase().includes(query.toLowerCase()));
    },
    render: () => {
      // Custom rendering logic
    },
  },
});

Custom Mention Rendering

This code configures the mention extension to render mentions with a custom label format, prefixing the label with '@'.

import { Mention } from '@tiptap/extension-mention';

const mention = Mention.configure({
  renderLabel({ options, node }) {
    return `@${node.attrs.label}`;
  },
});

Mention with Custom Attributes

This code configures the mention extension to include custom HTML attributes, such as a custom class and a data attribute for the mention ID.

import { Mention } from '@tiptap/extension-mention';

const mention = Mention.configure({
  HTMLAttributes: {
    class: 'custom-mention',
    'data-mention-id': (node) => node.attrs.id,
  },
});

Other packages similar to @tiptap/extension-mention

Keywords

FAQs

Package last updated on 10 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc